【JavaEE-bug集合】Exception occurred during processing request:

7人阅读 评论(0) 收藏 举报
分类:

出现这个错误我的是由于在使用struts2框架 时候使用模型驱动封装页面传来的参数时,没有给对象生成get set方法,给忘记了,还要实现getModel方法,返回对象,并且struts.xml中配置的action方法一定要存在于Action中

模型驱动封装参数正确的Action如下:

package cn.itheima.param;  
  
import java.util.Date;  
import java.util.Map;  
  
import com.opensymphony.xwork2.ActionContext;  
import com.opensymphony.xwork2.ActionSupport;  
//struts2如何获得参数  
//属性驱动获得参数  
import com.opensymphony.xwork2.ModelDriven;  
  
import cn.itheima.domain.User;  
//3.模型驱动  
//缺陷:只能返回一个对象  
//1->实现接口  
public class DemoAction1 extends ActionSupport implements ModelDriven<User>{  
    /* 
     * 页面设置<input type='text' name='name'/> 页面跟以前一样 
     * */  
    private User user=new User();//3->准备一个user对象 需要创建出对象来  
    public User getUser() {  
        return user;  
    }  
    public void setUser(User user) {  
        this.user = user;  
    }  
    public String execute() throws Exception {  
          
        return SUCCESS;  
    }  
      
    //2->实现方法返回对象  
    @Override  
    public User getModel() {  
        // TODO Auto-generated method stub  
        return user;  
    }  
      
}  

配置struts.xml (注意包名和方法名)

<package name="crm" namespace="/" extends="struts-default">
		<action name="CustomerAction_*" class="cn.itheima.web.action.CustomerAction" method="{1}">
			<result name="list" type="dispatcher">/jsp/customer/list.jsp</result>
			<result name="toList" type="redirectAction">
				<param name="actionName">CustomerAction_list</param>
				<param name="namespace">/</param>
			</result>
		</action>
		
		<action name="UserAction_*" class="cn.itheima.web.action.UserAction" method="{1}">
			<result name="toHome" type="redirect">/index.htm</result>
		</action>
	</package>

查看评论

request、response揭秘(备java基础,servlet,jsp,javaee)

掌握Request对象的作用,期属性,response特点。QQ群:264572737
  • 2016年10月12日 10:06

Exception occurred during processing request: null

Hibernate:      select         user0_.id as id1_0_,         user0_.username as username2_0_,    ...
  • dingxingmei
  • dingxingmei
  • 2015-04-03 14:46:24
  • 8690

Exception occurred during processing request: null 的错误原因以及解决办法

Exception occurred during processing request: null 的错误原因以及解决办法
  • MonkeyBrothers
  • MonkeyBrothers
  • 2017-12-01 23:59:44
  • 477

严重: Exception occurred during processing request: org.apache.struts2.json.JSONException: org.hiberna

严重: Exception occurred during processing request: org.apache.struts2.json.JSONException: org.hiberna...
  • lwyaqp
  • lwyaqp
  • 2015-12-14 15:43:36
  • 730

Java异常--dispatcher.Dispatcher:38 - Exception occurred during processing request: null

14:01:32,359 ERROR http-apr-8080-exec-7 dispatcher.Dispatcher:38 - Exception occurred during process...
  • qq_38637558
  • qq_38637558
  • 2017-10-25 14:41:11
  • 262

Exception occurred during processing request: user is not mapped [from user where username=:username

严重: Exception occurred during processing request: user is not mapped [from user where username=:user...
  • dingxingmei
  • dingxingmei
  • 2015-04-02 11:34:00
  • 3539

严重: Exception occurred during processing request: Unable to read XML

struts+hibernate框架 what's wrong? 2015-4-1 16:11:04 com.opensymphony.xwork2.util.logging.jdk.JdkLo...
  • dingxingmei
  • dingxingmei
  • 2015-04-01 18:10:36
  • 4337

struts2:Exception occurred during processing request: null

今天编写了struts2中通过token防止表单的重复提交,实现的过程中出现了struts2:Exception occurred during processing request: null异常 ...
  • lhy349
  • lhy349
  • 2013-10-11 11:36:56
  • 12904

错误中学习--Exception occurred during processing request: null

今天遇到的异常 Exception occurred during processing request: null 先描述一下问题的由来,在用struts2接收对象数据,报错,怎么取也是空 ...
  • Aurora_sss
  • Aurora_sss
  • 2017-06-17 20:10:39
  • 7722

总结遇到的错误

严重: Exception occurred during processing request: Expected positional parameter count: 1, actual par...
  • zhangsan_321
  • zhangsan_321
  • 2016-08-04 15:36:35
  • 1555
    个人资料
    持之以恒
    等级:
    访问量: 3227
    积分: 514
    排名: 9万+
    文章存档