<logic:present name="allpurview" scope="request">
<logic:iterate id="purview" name="allpurview" scope="request">
${purview.purviewname}<html:checkbox property="purview" value="${purview.id}"></html:checkbox>
</logic:iterate>
</logic:present>以上是输出所有的。  现在想要的效果是,若 ${adminpower.purview}的值比如是1,跟其中某个checkbox相同,则checkbox选中。怎么写!

解决方案 »

  1.   

    就跟你写Java代码类似的嘛,判断下输出的结果,也就是判断下条件是否成立。给你看个JSTL标签示例<c:choose>
      <c:when test=”${adminpower.purview=1}”>
         <input type="checkbox" name="..." value="..." checked></input>选中
         </c:when>
       <c:otherwise>
         <input type="checkbox" name="..." value="..." ></input>不选中
       </c:otherwise>
    </c:choose>以上代码只是示例,不一定能直接拿来用,就类似Java的if...else...
    Struts标签用的不是很多,不太熟悉,应该也有类似应用
      

  2.   

    个人感觉用了Struts的标签的话页面就和Struts捆绑在了一起,脱离了Struts就不太好使了,相比JSTL更通用些。不清楚的地方自己再Google下。
      

  3.   

    <script language="javascript">
    function chkAll_onclick(){
      if(typeof(adform.city) == "object"){
      if(adform.Allcity.checked){
       SelAll();
    }
    else{
       unSelAll();
    }
    }
    }
    function SelAll(){
       var intCount;
       var result="";
    if(adform.all("city").length > 1)
        {
        for(intCount = 0; intCount < adform.all("city").length; intCount++)
                    {
           adform.city(intCount).checked = true;
           result=result+adform.city(intCount).value+";";    
        }
    }
    else{
           adform.city.checked = true;
    }
           alert("你选中的是:"+result);
    }function unSelAll(){
        var intCount;
       if(adform.all("city").length > 1)
            {
        for(intCount = 0; intCount < adform.all("city").length; intCount++)
                    {
          adform.city(intCount).checked = false;
       }
    }
    else{
        adform.city.checked = false;
    }
    }
    </script><td width="97">
    <span class="STYLE10"> <input type="checkbox"
    name="Allcity" value="checkbox" onClick="chkAll_onclick()">
    全国 </span>
    </td>
    <td width="133">
    <span class="STYLE10"> <input type="checkbox"
    name="city" value="北京市"> &nbsp;北京市 </span>
    </td>
      

  4.   

    不能直接定义个String数组变量,然后用mutibox吗?
      

  5.   

    不能直接定义个String数组变量,然后用mutibox吗?