How to get JSP script value in struts tag
2 answers
You can write your code in two ways
<% request.setAttribute("lcItem", "Hello"); %><% pageContext.setAttribute("lcItem", "Hello"); %>
then if you want to access these values ββin Struts2 components, you can use #attr. as a prefix.
Example
<s:property value="#attr.lcItem">
Note. It will work fine with the request and the "pageContext".
<s:property value="lcItem" /> will not work because "lcItem" is not available in the Value Stack.
0