Reputation: 61
Using the code below
<%! int role; >
<%
UserMasterDTO userMasterDTO=(UserMasterDTO)session.getAttribute("userMasterDTO");
role = userMasterDTO.getRole();
%>
I want to get this value read by my struts if tag. How to achieve this?
Is below code not the correct way?
<s:if test="role == 1">
Upvotes: 1
Views: 3534
Reputation: 7937
Try struts 2.x 'if' tag:
<s:if test="#session.userMasterDTO.role==1">
or
<s:set name='role' value=xxxx>
Never using java code in jsp/template is a good habit.
Upvotes: 4