jsp数据提交页面:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<s:form action="userAction" namespace="/user" method="post">
<table width="200" border="1">
<tr>
<td>name</td>
<td><s:textfield name="user.name"/></td>
</tr>
<tr>
<td>password</td>
<td><s:textfield name="user.pwd"/></td>
</tr>
<tr>
<td colspan="2"><s:submit value="submit"/></td>
</tr>
</table>
</s:form>
</body>
</html>
控制台报错:
17:41:16,129 ERROR ParametersInterceptor:34 - Developer Notification (set struts.devMode to false to disable this message): Unexpected Exception caught setting 'user.name' on 'class $Proxy10: Error setting expression 'user.name' with value '[Ljava.lang.String;@12dcbd' 17:41:16,180 ERROR ParametersInterceptor:34 - Developer Notification (set struts.devMode to false to disable this message): Unexpected Exception caught setting 'user.pwd' on 'class $Proxy10: Error setting expression 'user.pwd' with value '[Ljava.lang.String;@1cbcf19' um----------------------:null
dao的实现类:
public class S3Impl implements UserDao{
private SessionFactory sessionFactory = null;
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
@Override
public boolean create(UserModel um) {
Session session = sessionFactory.getCurrentSession();
session.save(um);
return true;
}
}
页面报错:
Struts Problem Report Struts has detected an unhandled exception: Messages: attempt to create saveOrUpdate event with null entity File: org/hibernate/event/spi/SaveOrUpdateEvent.java Line number: 62
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
Acion类请事先ModelDriver接口!!
把你的action贴出来,你的错误可能是action中引用的实体类引起的
<divclass="ref">把你的action贴出来,你的错误可能是action中引用的实体类引起的
user类为空啊,你贴出来的错误已经写得很明显了,看下Struts配置吧<divclass="ref">