急!!請高手幫忙

wuliugeng發表於2006-03-31
為什麼從jsp表單能夠把值傳入到formbean,但在action中提取值時是空值,相應程式碼如下

 <logic:iterate id="AssessForm01"  name="AssessList">       
	  <tr>
            <td align="center" class="ListValue-TdCN">		
                <bean:write name="AssessForm01" property="assessId"/>&nbsp;
            </td>
            <td align="center" class="ListValue-TdCN"><bean:write name="AssessForm01" property="acontent"/>&nbsp;</td>          
            <td align="center" class="ListValue-TdCN">
	    <%
	         k=id[i++];	
		 //temp="value(assess"+k+")";
	        out.print("assess"+k);
	      // String name="value(el"+i+")";
	    %>
	       <html:radio property='<%="value(assess"+k+")"%>' value="SUP"/>優&nbsp;
	       <html:radio property='<%="value(assess"+k+")" %>' value="GOOD"/>良好&nbsp;
	       <html:radio property='<%= "value(assess"+k+")" %>' value="GENERAL"/>一般&nbsp;
	       <html:radio property='<%= "value(assess"+k+")"%>' value="DIFF"/>差&nbsp;
	       <html:radio property='<%= "value(assess"+k+")"%>' value="VERYBAD"/>很差&nbsp;	  
	       
	    </td>
          </tr>
	   
        </logic:iterate>


public void setValue(String key,Object value){
	MyDebug.println("map.pub("+key+","+value+")");    
	map.put(key,value);   
	MyDebug.println("get: "+map.get(key));
	MyDebug.println("map size: "+map.size());
    }
    public Object getValue(String key){
	 MyDebug.println("asdfds "+map.get(key));   
	 MyDebug.println("key: "+key);
	 return map.get(key);   
    }


 private ActionForward performStudentAssess(ActionMapping mapping, ActionForm actionform,
                                              HttpServletRequest request, HttpServletResponse response) {
        ActionForward forward=null;
        AssessForm form=(AssessForm)actionform;
	MyDebug.println("you assess teacher is: "+form.getTeachName()); 
	ArrayList elects=new ArrayList();
	elects.add(new LabelValueBean("優","SUP"));
	elects.add(new LabelValueBean("良好","GOOD"));
	elects.add(new LabelValueBean("一般","GENERAL"));
	elects.add(new LabelValueBean("差","DIFF"));
	elects.add(new LabelValueBean("很差","VERYBAD"));
        MyDebug.println("action is: "+form.getStrutsAction());
	MyDebug.println("genRadioValue is: "+form.getGenRadioValue());
	MyDebug.println("map size: "+form.getMap().size());
	MyDebug.println("ddd: "+request.getParameter("assess1"));
        try {
             ArrayList assessno=proxy.getAssessNo();
             String assess[]=new String[assessno.size()];
	    // AssessModel amodel=form.getModel();
            if(form.getStrutsAction()==0){
	       MyPagers pager=form.getPager();
		//ArrayList assessno=proxy.getAssessNo();
                ArrayList assesslist=proxy.Query(form.getModel());
                MyDebug.println("Total Assess Record: "+assesslist.size());
                if(assesslist==null || assesslist.size()==0){
                    MyDebug.println("Assess Record is null");
                    request.setAttribute(MyContants.Error_Name,MyUtility.getMessage("label.NoData"));
                }else{
                    request.getSession().setAttribute("AssessNoList",assessno); 
		    request.getSession().setAttribute("Elects",elects);
                    request.getSession().setAttribute("AssessList",assesslist);
                    request.setAttribute(MyContants.Pager_Session,pager);
                     MyDebug.println("setAttribute complete");
                }
		
            }else{
                 int id[]=new int[assessno.size()];
	       ArrayList selscore=new ArrayList();	
	       for(int j=0;j<assessno.size();j++){
                 // assess[j]=(String)assessno.get(j);
		 String temp=(String)assessno.get(j);
                  //int key=Integer.parseInt(assess[j]);
	         String assid="assess"+temp;
		 
		 // String assid=Integer.toString(j);
		  MyDebug.println("assess: "+assid);
	          String e=(String)form.getValue(assid);
		  MyDebug.println("assessvalue: "+e);
	          selscore.add(e);
                }    
		MyDebug.println("begin caculate");
		MyDebug.println("selscore size: "+selscore.size());
		CaCulateProxy ccproxy=new CaCulateProxy();
		String stdno=(String)request.getSession().getAttribute("userId");
		TeacherProxy tproxy=new TeacherProxy();
		TeacherModel tmodel=tproxy.QueryByTeacherName(form.getTeachName());
		if(selscore==null||selscore.size()==0){
			MyDebug.println("selscore is null");
			return forward=mapping.findForward("success");
		}else{
		float genass=ccproxy.GeneralAss(selscore);
		ccproxy.CaScore(ccproxy.SelCorseTran(selscore),genass,tmodel.getTeachNo(),stdno);
		form.setGenRadioValue(ccproxy.ApprisRank(selscore));
                form.reset(mapping,request);   
		}
            }
        } catch (Exception e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
             request.setAttribute(MyContants.Error_Name,MyUtility.getMessage("Teach.Assess.Error.SearchAssessError"));
        }
      
        forward=mapping.findForward("success");
        MyDebug.println("complete");
        return forward;  //To change body of created methods use File | Settings | File Templates.
    }

相關文章