1

I have a problem while converting the spring check box tag to struts...
I have checkbox tag written in spring which i need to convert it into struts using the values coming from database into the pojo the check box shuld be enabled and disabled according to that..
Following is the code fragment on checkbox in spring:

<c:forEach  var="menuList" items="${roleMenuActionMappingBean.menuList}" varStatus="status">
    <form:checkbox path="menuList[${status.index}].active"  id="a_${menuList.getMenuKey()}" value="${menuList.getMenuKey()}"/>
    <form:hidden path="menuList[${status.index}].menuKey" value="${menuList.getMenuKey()}"/>

And also what is this:-

menuList[${status.index}]
<c:choose>
    <c:when test="${menuList.getViewCheckBoxDisabled().equals('true')}">
        <p><form:checkbox path="menuList[${status.index}].viewCheckBox" id="v_${menuList.getMenuKey()}" value="${menuList.getMenuKey()}"/></p>
    </c:when> 
    <c:otherwise>
        <p><form:checkbox path="menuList[${status.index}].viewCheckBox"  id="v_${menuList.getMenuKey()}" value="${menuList.getMenuKey()}" disabled="true"/></p>
    </c:otherwise>    
</c:choose>
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
Ankit Duggal
  • 55
  • 2
  • 13
  • Have you checked the relevant tag reference in http://struts.apache.org/release/2.3.x/docs/checkbox.html ? – mmalmeida Oct 23 '13 at 12:34

1 Answers1

1

Migrating from SpringMVC(+JSTL) to Struts 2:

    • JSTL WHEN and OTHERWISE:

      <c:when>
         <!-- stuff -->
      </c:when>
      <c:otherwise>
         <!-- stuff -->
      </c:otherwise>
      
    • Struts 2 IF and ELSE :

      <s:if>
         <!-- stuff -->
      </s:if>
      <s:else>
         <!-- stuff -->
      </s:else>
      
    • IF ELSE example

Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243