Pergunta

i am iterating a Vo in Jsp using struts tag in which i get a integer value

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

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

here userType is a int value. how can i get this value in

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

so i can process it for display.

Or is there any other way through which i can display String value depend upon coming int value?

Foi útil?

Solução 2

i used struts logic:equal tag to do this and its works fine for me

<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>

Outras dicas

Sounds like you should you <c:choose>. For example:

<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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top