Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Handling JSTL tags authored from dialog

aemninja
Level 4
Level 4

Hello All - Can someone please tell me if you have implemented the scenario in JSP based component as HTL doesn't support Taglibs: Author the JSTL tags and process it. 

Currently the JSTL tags authored in printing as is and it is not processed. Please let me know.

1 Accepted Solution
markus_bulla_adobe
Correct answer by
Employee
Employee

Hi @aemninja!

 

While JSPs are still supported (as well as EcmaScript and JST) and it is totally possible to implement and use JSTL in this context I would not recommend to follow that path. 

HTL is the preferred and recommended server-side templating system for HTML in AEM. AEM Core Components are implemented with HTL and they can be seen as a best practice reference implementation. Personally, JSTL feels a bit outdated to me in the context of AEM. I haven't seen it in a project for quite some time and can't think of any advantages that it would have nowadays.

 

Also I'm not quite sure about the approach that you are outlining. When you talk about "authoring JSTL tags" , you probably mean that in terms of the development cycle, right? Because I would definitely avoid to allow JSTL usage (as well as anything else that might somehow "smell" like programming including JavaScript and HTML source code) for content editors. That's a discouraged practice and comes with a whole lot of other implications to your applications stability and security.

 

Hope that helps!

 

 

View solution in original post

4 Replies
markus_bulla_adobe
Correct answer by
Employee
Employee

Hi @aemninja!

 

While JSPs are still supported (as well as EcmaScript and JST) and it is totally possible to implement and use JSTL in this context I would not recommend to follow that path. 

HTL is the preferred and recommended server-side templating system for HTML in AEM. AEM Core Components are implemented with HTL and they can be seen as a best practice reference implementation. Personally, JSTL feels a bit outdated to me in the context of AEM. I haven't seen it in a project for quite some time and can't think of any advantages that it would have nowadays.

 

Also I'm not quite sure about the approach that you are outlining. When you talk about "authoring JSTL tags" , you probably mean that in terms of the development cycle, right? Because I would definitely avoid to allow JSTL usage (as well as anything else that might somehow "smell" like programming including JavaScript and HTML source code) for content editors. That's a discouraged practice and comes with a whole lot of other implications to your applications stability and security.

 

Hope that helps!

 

 

View solution in original post

aemninja
Level 4
Level 4
@markus_bulla_adobe - Thanks for your reply. Yes, I too agree that JSTLs are outdated but we have some utilities written in JSTL and it is still in use. In one of the component, we are providing the capability to the authors to author the JSTL tags from the dialog and that should be processed. The JSTL are not processed if we process it from the node properties. If I hardcode the same JSTL tags on the componeny, it is loading fine. Not sure how to handle this use case.
markus_bulla_adobe
Employee
Employee

Hi @aemninja!

It's hard to say without knowledge of your implementation approach.

But please let me repeat and raise this again: giving the content authors the possibility to author any kind of programming language (be it JSTL, HTML, JavaScript or whatever) is a highly discouraged practice. I would definitely look for another solution to your requirements. As you are already aware that even the technology is no longer state of the art, you may want to reevaluate and probably think about migrating your utilities to something more up-to-date.

You have provided little context here, but other approaches that come to mind here could be:

  • Giving your content authors a list of functionality to choose from and integrating the according JSTL functionality from templates that have been developed and tested through your regular development cycle.
  • If you just need to fill in certain values, you could use a dedicated syntax in your editor, e.g. similar to Expression Language like "This product is available in ${country} only." and replace according placeholders at render time.

The requirement for at least some kind of "free HTML" component comes up in nearly every project at a certain point in time. I understand the business use case behind such requirements but from a technical point of view I still object and recommend to not have something like this. Taking this from HTML to JSTL feels even worse to me. If your really, really need to follow this approach, please add as many guard rails as possible and restrict the usage of such a component as much as possible (probably only to a very limited set of tech-savvy super users).

snbaem
Community Advisor
Community Advisor

Hello,

I have seen scenarios where complex jstl logic in jsp and utilities used for taglibs need to be used for HTL conversion of the component. The conclusion for us at the end was to convert everything to HTL specifications and do some design changes if necessary. There have been changes in AEM implementations in these regards (HTL) and better to adhere to current standards. Regarding authoring capability of JSTL, that is something we should avoid I feel and change the input to a controlled level only for the authors. Not a solution I suppose to what was asked but the basic message is I think Do not do what you are looking to do 🙂 

 

Regards