Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to pass hash value from URL to java via sightly?

Avatar

Level 3

Hi,

Can we pass hash value from JS (window.location.hash) to model via HTL code.

1 Accepted Solution

Avatar

Correct answer by
Level 10

I believe when you adapt the Model from SlingHttpServletRequest, it should be available from your request. If not, then you may retrieve it in js/jquery/any other framework/lib and then pass it to server via ajax/form post/hidden param etc. based on your use case.

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

I believe when you adapt the Model from SlingHttpServletRequest, it should be available from your request. If not, then you may retrieve it in js/jquery/any other framework/lib and then pass it to server via ajax/form post/hidden param etc. based on your use case.

Avatar

Level 10

As Gaurav suggests - try to pass to a Java AEM service using AJAX. TYpically values are passed to HTL Java via component dialogs. However - this value cannot be passed in this manner.

Avatar

Level 10

Or a possible solution here is to build a custom sling resource type - which is based on JavaScript anyhow. THen you can get this value via the custom type and pass as part of the component dialog.