2012-09-20 36 views
0

我使用Struts标签中,我得到一个整数值我怎样才能从Struts的逻辑值:变量

<struts_logic:iterate id="usersVO" indexId="index" name="data" type="utils.vo.UsersVO"> 

<td class="tabletext"><struts_bean:write name="usersVO" property="userType"/></td> 

这里USERTYPE是一个int值在迭代JSP中的VO iterate标签。 我怎么能得到这个值在

<% 
    int x = **here** 
%> 

所以我可以处理它的显示。

或者是否有任何其他方式可以通过我可以显示字符串值取决于即将int值?

回答

0

我用支柱逻辑:等于标签来做到这一点,它工作正常,我

<struts_logic:equal name="usersVO" property="userType" value="0"> 
    <struts_bean:message key ="usermanagement.NotAuthorization"/>      
</struts_logic:equal> 
<struts_logic:equal name="usersVO" property="userType" value="1"> 
    <struts_html:link page="/anzeige.do" paramId="authorization" paramName="usersVO" paramProperty="userName" style="text-decoration: none;"> 
     <struts_bean:message key ="usermanagement.Authorization" /> 
    </struts_html:link> 
</struts_logic:equal> 
1

听起来像你,你应该<c:choose>。例如:

<c:choose> 
    <c:when test="${usersVO.userType==1}"> 
     <p>User type is 1</p> 
    </c:when> 
    <c:when test="${usersVO.userType==2}"> 
     <p>etc</p> 
    </c:when> 
    <c:otherwise> 
     <p>User type is unknown</p> 
    </c:otherwise> 
</c:choose> 
+0

感谢你的努力 – pd27

+0

这是否解决问题了吗? –

+0

不,我没有使用这个,看到我用我的答案。 – pd27