废话少说,上代码struts-config.xml配置文件<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"><struts-config>
  <data-sources />
  <form-beans>
  <form-bean name="bbsForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="file" type="org.apache.struts.upload.FormFile"/>
<form-property name="forumpost" type="hk.egame.bbs.entity.BbsForumPost"/>
<form-property name="forumthread" type="hk.egame.bbs.entity.BbsForumThread"/>
<form-property name="userinfo" type="hk.egame.bbs.entity.BbsUserinfo"/>
<form-property name="forumforum" type="hk.egame.bbs.entity.BbsForumForum"/>
<form-property name="page" type="hk.egame.amms.misc.Page" />
</form-bean>
  </form-beans>
  <global-exceptions />
  <global-forwards>
  <forward name="error" path="/error.jsp" />
  </global-forwards>
  <action-mappings>
  <action path="/bbs/forum" type="org.springframework.web.struts.DelegatingActionProxy"
   name="bbsForm" parameter="method" scope="request">
   <forward name="listForum" path="/admin/form/forum_list.jsp" />
  </action>
  </action-mappings>
  <controller bufferSize="4096"></controller>
<message-resources parameter="cn.jsprun.struts.ApplicationResources" />
<message-resources parameter="messages_zh" />
</struts-config>action
public ActionForward forumlist(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) { DynaActionForm bbsForm = (DynaActionForm) form;
System.out.println(bbsForm);
                .....................
return mapping.findForward(Constants.LISTFORUM);打印
null請求 :http://localhost/bbs/forum.do?method=forumlist
小弟实在不解,那里出问题了,以前走正常的...........

解决方案 »

  1.   

    DynaActionForm bbsForm= (DynaActionForm)form.getString("bbsForm");
      

  2.   

    DynaActionForm bbsForm= (DynaActionForm)form.getString("bbsForm");
      

  3.   

    问题是 ActionForm form 在
    public ActionForward forumlist(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) {已经为空,debug看不到任何值
      

  4.   

    你的operation参数呢,你用的是DispatchAction
      

  5.   

    不知道,那里出问题了.........求解用的是 public class PostThreadAction extends DispatchAction {
    public void forumlist(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) { DynaActionForm bbsForm = (DynaActionForm) form;

    System.out.println(form+"||"+mapping);
    }
      

  6.   

    楼主你看下这个http://code.google.com/p/j2eewiki/wiki/StrutsDynaActionForm
      

  7.   

    JSP的提交路径是怎样的?贴出来!
      

  8.   

    你用Struts和Spring整合了吧?
    struts-config.xml的<action type="">我没像你那样写过,
    我知道的写法是:在struts-config.xml里加上以下代码:
    <controller processorClass="org.springframework.web.struts.DelegatingRequestProcessor">
    </controller>
    type就不需要了,但是path要和applicationContext.xml里配置的action的名字保持一致。
      

  9.   

    这个肯定是为空的。应该你在ACTION里还没有自动获取从页面传过来的表单信息
    action
    public ActionForward forumlist(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response) {DynaActionForm bbsForm = (DynaActionForm) form;在这里写上从页面上传来的表单所传信息的类,例如:
    UserInfo userInfo=(UserInfo)bbsForm.get("userinfo");System.out.println(bbsForm);
      .....................
    return mapping.findForward(Constants.LISTFORUM);
      

  10.   

    我用的是 S1SH,使用的是动态bean...........
      

  11.   


    问题是 参数form就是空.........