This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am new to struts and am stuck at a point.
I have my hello.jsp
<s:iterator status="toyCategory" value="#session.ToyCategory" >
The dynamic content in the js file does not get evalued , the property file is displayed as the server side code
var id<s:property value="#toyCategory.index"/> This gets rendered when i check the view source page on the browser
But if i take the whole script and place it in the jsp it evaluates it fine .
Is there something else i need to add when i use the script tag ?
Are you including struts tags in a JS file??? This will not work. If you need something like this, you can set the value of the required fields in the JSP page. Something like
This example will not work in this specific case as the id variable will be set to a new value multiple times with each iteration but since I don't know why you are including the same JS file multiple times (it seems unnatural to me) so I can't tell you a solution...
I am using struts2 . I am trying to have the struts tags in the .js file. and would like the content in the file be built dynamically. I do understand that the .js is executed in the browser side. so hence the dyanmic part in the js does not get executed.
This is my code
I can manually build this out and have no issues
In my jsp
the only way i have found this works is rename the .js to .jsp and then the server will take care of interpreting the struts2 tags
Thats why i wanted to find out if there a way of mapping the .js to be intercepted by the interceptor or servlet ...
or is there another solution