Expand my Community achievements bar.

SOLVED

Calling USE API script from JSP

Avatar

Level 2

What is the alternative for the data-sly-use attribute in JSP. Is there any other way to call use api scripts from a .jsp file?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@PremIB As per my knowledge you need to write the whole logic into the JSP file itself and inside the scriptlet tags.

ex.

 

<%

String propertyName = properties.get("propertyName", String.class);

%>

 

P.S.  It better to use Sightly /HTL based component over JSP based component.

 

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

@PremIB As per my knowledge you need to write the whole logic into the JSP file itself and inside the scriptlet tags.

ex.

 

<%

String propertyName = properties.get("propertyName", String.class);

%>

 

P.S.  It better to use Sightly /HTL based component over JSP based component.

 

Avatar

Level 2

@Suraj_KamdiI am trying to overlay the richtext widget from /libs/cq/gui/components/authoring/dialog/richtext/render.jsp in /apps then call a javascript use api script from that jsp file. Here, I do not have an option to use HTL to directly call the script with data-sly-use, because i am not sure about changing the jsp script to HTL. if you can refer me to an updated HTL version of the RichText widget, that would be enough for me. Also, I cannot move my javascript use api script's logic to jsp either, it is already referenced by multiple HTL files.

Avatar

Community Advisor

Hi,

 

What is the use case here? Please see https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/calling-custom-utility-met... if that is useful.

Ideally if you have backend implementation already as a Model try to use HTL. Keep the backend implementation logic in service components so that if you have to use jsp, it can be called within jsp.

Another way (may be not ideal) use a .html file to use the data-sly-use attribute. Use or include this HTL file within the ultimate jsp where you are looking to use the data-sly-use attribute