开发者社区> 问答> 正文

整合ssh时报错:Messages: attempt to create sav?报错

 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


展开
收起
爱吃鱼的程序员 2020-06-22 19:31:53 516 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    Acion类请事先ModelDriver接口!!

    把你的action贴出来,你的错误可能是action中引用的实体类引起的

    <divclass="ref">

    引用来自“快跑的蜗牛”的答案

    <divclass=ref_body>

    把你的action贴出来,你的错误可能是action中引用的实体类引起的

    user类为空啊,你贴出来的错误已经写得很明显了,看下Struts配置吧<divclass="ref">

    引用来自“throwable”的答案

    <divclass=ref_body>user类为空啊,你贴出来的错误已经写得很明显了,看下Struts配置吧<divclass="ref">

    引用来自“抓瓦Or”的答案

    <divclass=ref_body>Acion类请事先ModelDriver接口!!在action类里定义了user这个变量,以及给这个user定义setter和getter方法了吗??jsp里用了user.pwd,在action里要定义对应的user变量,并且其对象包含对应的pwd属性<divclass="ref">

    引用来自“tifa4ever”的答案

    <divclass=ref_body>在action类里定义了user这个变量,以及给这个user定义setter和getter方法了吗??jsp里用了user.pwd,在action里要定义对应的user变量,并且其对象包含对应的pwd属性<divclass="ref">

    引用来自“抓瓦Or”的答案

    <divclass=ref_body>Acion类请事先ModelDriver接口!!<divclass="ref">

    引用来自“小兴”的答案

    <divclass=ref_body><divclass="ref">

    引用来自“tifa4ever”的答案

    <divclass=ref_body>在action类里定义了user这个变量,以及给这个user定义setter和getter方法了吗??jsp里用了user.pwd,在action里要定义对应的user变量,并且其对象包含对应的pwd属性

    2020-06-22 19:32:08
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
Borgaonkar-New-Adventures-In-Spying-3G-And-4G-Users-Locate-Track-And-Monitor 立即下载
Well-That-Escalated-Quickly-How-Abusing-The-Docker-API-Led-To-Remote-Code-Execution-Same-Origin-Bypass-And-Persistence 立即下载
Customer Success Dashboard GoD 立即下载