Invoking method inside JSP from Sightly(HTL) | Community
Skip to main content
Level 2
Sep 16, 2018 7:10 AM UTC
Solved

Invoking method inside JSP from Sightly(HTL)

Hello Guys,

I have a JSP where all my util methods are written(can't use Java class), I included the JSP in my html(sightly file)  and failed trying to invoke the methods. I can only use JavaScript use API. Any suggestions?

Thanks,

AG

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Sep 17, 2018 1:19 PM UTC

Hi,

Those documents explain how to use JS API instead Java or JSP.

But you can't call JSP methods from HTL or JS API but you can convert JSP code into Java or JS and use inside HTL.

Arun Patidar

7 replies

arunpatidar
arunpatidarAccepted solution
New Participant
Sep 17, 2018 1:19 PM UTC

Hi,

Those documents explain how to use JS API instead Java or JSP.

But you can't call JSP methods from HTL or JS API but you can convert JSP code into Java or JS and use inside HTL.

Translate
Arun Patidar
smacdonald2008
Level 10
Sep 17, 2018 1:13 PM UTC

Here is an artilce that talks about how to use the JS API for HTL -- Creating a Tab layout component for Adobe Experience Manager

NOTE - you cannot use JSP with HTL as ppl on this thread mentioned. You can use JS with HTL - not JSP. The best way is to implement your methods in Java or use Sling Models.

Translate
AG19Author
Level 2
Sep 17, 2018 12:55 PM UTC

Hi Arun,

I gone through all those documentations, nothing helped. None of them has an example of invoking jsp methods in HTL or JavaScript use API.

Translate
AG19Author
Level 2
Sep 17, 2018 9:43 AM UTC

Hi edubey,

Please share the syntax or example how I can call using JavaScript use API. I tried but not getting the output.

Thanks.

Translate
edubey
Level 10
Sep 17, 2018 8:23 AM UTC

You can't use JSP method in HTL file.

But you can use JavaScript use API, any specific issue with it?

Translate
joerghoh
Employee
Sep 16, 2018 6:50 PM UTC

No, in HTL you can only access model classes (SlingModels or WcmUse classes), but you cannot invoke methods from JSPs. And btw this really pollutes your application design and makes testing unnecessary hard.

Jörg

Translate