日期:2014-05-18  浏览次数:20709 次

JSP的复选框问题。望各位牛人解决。
struts代码如下:
public   ActionForward   view1(ActionMapping   mapping,   ActionForm   form,
HttpServletRequest   request,   HttpServletResponse   response){
Integer   id   =   new   Integer(request.getParameter( "userid "));
UserInfo1   user   =   new   UserInfo1();
user   =   (UserInfo1)usermanger.createQuery( "from   UserInfo1   as   q   where   q.userInfo.userId=:loginId ").setInteger( "loginId ",id).uniqueResult();
//取得表中含,的字段
String   ss   =   user.getIlikeEat();
String   ss1   =   user.getIfeeli().substring(0);
String   ss2   =   user.getMySports().substring(0);
String   ss3   =   user.getMfSuperority().substring(0);
String   ss4   =   user.getFavSite().substring(0);
String   ss5   =   user.getInterestTopic().substring(0);
String   ss6   =   user.getFindPartner().substring(0);
String   ss7   =   user.getThinkAlotOf().substring(0);
String   ss8   =   user.getFamRelat().substring(0);
//将字段进行处理
String[]   aa   =   ss.substring(0).split( ", ");
String[]   aa1   =   ss1.substring(0).split( ", ");
String[]   aa2   =   ss2.substring(0).split( ", ");
String[]   aa3   =   ss3.substring(0).split( ", ");
String[]   aa4   =   ss4.substring(0).split( ", ");
String[]   aa5   =   ss5.substring(0).split( ", ");
String[]   aa6   =   ss6.substring(0).split( ", ");
String[]   aa7   =   ss7.substring(0).split( ", ");
String[]   aa8   =   ss8.substring(0).split( ", ");
HashMap   hm   =   new   HashMap();
//放到集合中
hm.put( "aa ",   aa);  
hm.put( "aa1 ",   aa1);
hm.put( "aa2 ",   aa2);
hm.put( "aa3 ",   aa3);
hm.put( "aa4 ",   aa4);
hm.put( "aa5 ",   aa5);
hm.put( "aa6 ",   aa6);
hm.put( "aa7 ",   aa7);
hm.put( "aa8 ",   aa8);
System.out.print(hm.size()+ "=00000000000000000 ");
//绑定在request当中
request.setAttribute( "hm ",   hm);
JSP页面代码如下
<body>
           
<logic:iterate     id= "String "   collection= "${hm} ">
<logic:iterate   id= "a "   name= "String "   property= "value ">
<td> <input   name= "fengkuang "   type= "checkbox "   id= "fengkuang "   value= "疯狂 "   <c:if   test= "${a   eq   '疯狂 '} "> checked= 'true ' </c:if> >
            疯狂 </td>
                    <td> <input   name= "wenzhong "   type= "checkbox "   id= "wenzhong "   value= "稳重 "   <c:if   test= "${a} "> </c:if> >
            稳重 </td>
                    <td> <input &nbs