Reputation: 311
Actually, when I use scriplets: <%= session.getAttribute("loginId") %>
the value is printed on page . The problem arises when I use Expression Language, then it doesn't show anything.
<td>LoginId: </td>
<td><input type="text" value="${loginId}" /></td>
Upvotes: 1
Views: 59
Reputation: 311
Finally I found the solution to this problem. The correct syntax to use when accessing session attributes in struts2 is:
<s:property value="#session['key']"/>
Upvotes: 1
Reputation: 4135
Use
<s:property value="#session.loginId"/>
or
${session.loginId}
to display session scoped variable value.
Upvotes: 1