public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
      语句………………
}中的form 为空怎么回事??

解决方案 »

  1.   

    你的语句呢?
    正常的是AdminForm aForm = (AdminForm)form;
    然后语句……
      

  2.   

    FwInfoForm fwInfoForm = (FwInfoForm)form;
    FwInfo fwInfo = new FwInfo();
    fwInfo.setTitle(fwInfoForm.getItem().getTitle());
    获取里面值就会报错,监视以后form 为null;
      

  3.   

    你在struts-config.xml文件里面配置了吗?
    <form-beans >
        <form-bean name="FwInfoForm" type="这里为全限定类名">
    </form-beans >
      

  4.   

    <form-beans>
        <form-bean name="FwInfoForm" type="webForm.FwInfoForm" ></form-bean>
    </form-beans>
    <global-exceptions />
    <global-forwards />
    <action-mappings >
        <action name="FwInfoForm" path="/post" type="webAction.FwInfoAction" scope="session" >
          <forward name="index" path="/index.jsp" />
    ……………………
      

  5.   

    你的表单和FwInfoForm类贴出来看下!
      

  6.   

    查看配置文件,还有jsp页面form的名字
      

  7.   


    你应该看你的fwInfoForm是否为空,如果为空,看你的值是否传得正确
      

  8.   

    <action
          attribute="FwInfoForm"
          input="/index.jsp"
          name="FwInfoForm"
          path="/post"
          scope="session"
          type="webAction.FwInfoAction">
          <forward name="index" path="/index.jsp" />   
    </action>加attribute属性为FwInfoForm!