1.struts2 if判断语句:

<s:if test="%{funcVo.parentFuncId  == 0}">

修改子系统

</s:if>

<s:else>

修改子功能

</s:else>


2. sturts2 iterator遍历

<select id="roleId" name="userVo.roleId" style="width:150px;height:26px;">

<s:iterator value="roleData.dataList" id="roleVo">

<option value="${roleVo.roleId }">

${roleVo.roleName }

</option>                  

</s:iterator>

</select>


3.JSP forEach使用 下拉列表显示后台选中的值。

<c:forEach var = "fVo" items = "${funcList}">

<c:choose>

<c:when test="${fVo.funcId==parentFuncId}">

<option value="${fVo.funcId }" selected="selected">

<c:out value="${fVo.funcName }"/>

</option>

</c:when>

<c:otherwise>

<option value="${fVo.funcId }">

<c:out value="${fVo.funcName }"/>

</option>

</c:otherwise>

</c:choose>

</c:forEach>  

4.单选按钮根据后台设置值为选中状态

<input name='userVo.sexType' type="radio" value='<%=Constant.WOMAN %>' />

调用的方法:initradio('userVo.sexType','${userVo.sexType}');

           function initradio(rName,rValue){  

               var rObj = document.getElementsByName(rName);  

               for(var i = 0;i < rObj.length;i++){  

                   if(rObj[i].value == rValue){  

                       rObj[i].checked =  'checked';  

                   }  

               }  

           }