- 浏览: 1524868 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (525)
- SEO (16)
- JAVA-EE-Hibernate (6)
- JAVA-EE-Struts (29)
- JAVA-EE-Spring (15)
- Linux (37)
- JAVA-SE (29)
- NetWork (1)
- CMS (14)
- Semantic Research (3)
- RIA-Flex (0)
- Ajax-Extjs (4)
- Ajax-Jquery (1)
- www.godaddy.com (0)
- SSH (34)
- JavaScript (6)
- SoftwareEngineer (9)
- CMMI (0)
- IDE-Myeclipse (3)
- PHP (1)
- Algorithm (3)
- C/C++ (18)
- Concept&Items (2)
- Useful WebSite (1)
- ApacheServer (2)
- CodeReading (1)
- Socket (2)
- UML (10)
- PowerDesigner (1)
- Repository (19)
- MySQL (3)
- SqlServer (0)
- Society (1)
- Tomcat (7)
- WebService (5)
- JBoss (1)
- FCKeditor (1)
- PS/DW/CD/FW (0)
- DesignPattern (11)
- WebSite_Security (1)
- WordPress (5)
- WebConstruction (3)
- XML|XSD (7)
- Android (0)
- Project-In-Action (9)
- DatabaseDesign (3)
- taglib (7)
- DIV+CSS (10)
- Silverlight (52)
- JSON (7)
- VC++ (8)
- C# (8)
- LINQ (1)
- WCF&SOA (5)
- .NET (20)
- SOA (1)
- Mashup (2)
- RegEx (6)
- Psychology (5)
- Stock (1)
- Google (2)
- Interview (4)
- HTML5 (1)
- Marketing (4)
- Vaadin (2)
- Agile (2)
- Apache-common (6)
- ANTLR (0)
- REST (1)
- HtmlAnalysis (18)
- csv-export (3)
- Nucth (3)
- Xpath (1)
- Velocity (6)
- ASP.NET (9)
- Product (2)
- CSS (1)
最新评论
-
lt26w:
理解成门面模式应该比较容易明白吧
FacadePattern-Java代码实例讲解 -
lt26w:
看下面的例子比较明白.
FacadePattern-Java代码实例讲解 -
javaloverkehui:
这也叫文档,别逗我行吗,也就自己看看。
HtmlCleaner API -
SE_XiaoFeng:
至少也应该写个注释吧。
HtmlCleaner API -
jfzshandong:
...
org.springframework.web.filter.CharacterEncodingFilter 配置
attempt to create delete event with null entity 分析及解决
srtuts,spring连续删除的问题
很明显 你删除了 一条不存在的记录 这种错误 可能是你ID传值有误 还有可能就是你重复提交 删了一次 第二次 接着删 肯定报错了
1. 描述
删除一个对象后,按F5刷新
,出现错误。MyEclispe控制台下异常显示:
java.lang.IllegalArgumentException: attempt to create delete event with null entity
并且浏览器地址还是指向那个被删除的对象。如删除id=30的实体后,浏览器地址为 http://122.204.85.183:8080/PKJava/delete.do?id=30
2. 分析
请参照:http://fengzi015.spaces.live.com/blog/cns!fc609e3f70f965cf!247.entry
返回查询结果部分的问题,也就是说,是:删除记录之后返回的记录集没有刷新。删除的实体在结果集中没有清除。在刷新页面时,将前一form提交的内容都作为hidden又全传了回来,且是不断累加的。
3. 解决方法
在转到新界面时,刷新界面。
只需要修改sttruts.xml中delete action的配置。在delete action的<forward />中加入一个参数redirect="true"。
redirect默认值是false。
======
4月7日
连续删除的问题
jsp:
<ec:table items="result"
var="pres"
filterable="false"
imagePath="${pageContext.request.contextPath}/html/commons/ximages/*.gif"
rowsDisplayed="10"
action=""
form="confTypeForm">
<ec:row highlightRow="true">
<ec:column property="typeId"
headerStyle="text-align:center"
title="<%=GetProperty.getProperties("conftype.id",getServletContext())%>" >
<input name="ids_allbox" type="checkbox" value="${pres.typeId}">
<a href="<%=ContextUtil.getCtxPath(request)%>/para/modifyconftype.do?id=${pres.typeId}">${pres.typeId}</a>
</ec:column>
<ec:column property="typeName" headerStyle="text-align:center"
style="text-align:center"
filterable="false"
sortable="false"
title="<%=GetProperty.getProperties("conftype.name",getServletContext())%>" />
<ec:column property="comments" headerStyle="text-align:center"
style="text-align:center"
filterable="false"
sortable="false"
title="<%=GetProperty.getProperties("conftype.comments",getServletContext())%>" />
</ec:row>
</ec:table>
var="pres"
filterable="false"
imagePath="${pageContext.request.contextPath}/html/commons/ximages/*.gif"
rowsDisplayed="10"
action=""
form="confTypeForm">
<ec:row highlightRow="true">
<ec:column property="typeId"
headerStyle="text-align:center"
title="<%=GetProperty.getProperties("conftype.id",getServletContext())%>" >
<input name="ids_allbox" type="checkbox" value="${pres.typeId}">
<a href="<%=ContextUtil.getCtxPath(request)%>/para/modifyconftype.do?id=${pres.typeId}">${pres.typeId}</a>
</ec:column>
<ec:column property="typeName" headerStyle="text-align:center"
style="text-align:center"
filterable="false"
sortable="false"
title="<%=GetProperty.getProperties("conftype.name",getServletContext())%>" />
<ec:column property="comments" headerStyle="text-align:center"
style="text-align:center"
filterable="false"
sortable="false"
title="<%=GetProperty.getProperties("conftype.comments",getServletContext())%>" />
</ec:row>
</ec:table>
java:
Action:
String[] ids = request.getParameterValues("ids_allbox");
if (ids != null) {
try {
ParameterUtil.deleteConferenceType(ids);
} catch (Exception e) {
e.printStackTrace();
return mapping.findForward("error");
}
}
request.setAttribute("result", ParameterUtil.getAllConferenceType());
return mapping.findForward("viewconftype");
if (ids != null) {
try {
ParameterUtil.deleteConferenceType(ids);
} catch (Exception e) {
e.printStackTrace();
return mapping.findForward("error");
}
}
request.setAttribute("result", ParameterUtil.getAllConferenceType());
return mapping.findForward("viewconftype");
java:
Util:
public static boolean deleteConferenceType(String[] ids) {
ConferenceTypeDAO dao = ConferenceTypeDAO.getInstance();
Transaction t = beginTransaction();
try {
dao.deleteConferenceType(ids);
t.commit();
return true;
}catch (HibernateException he) {
he.printStackTrace();
t.rollback();
return false;
}finally{
closeSession();
}
}
ConferenceTypeDAO dao = ConferenceTypeDAO.getInstance();
Transaction t = beginTransaction();
try {
dao.deleteConferenceType(ids);
t.commit();
return true;
}catch (HibernateException he) {
he.printStackTrace();
t.rollback();
return false;
}finally{
closeSession();
}
}
java:
DAO:
public void deleteConferenceType(String[] confTypeIds) throws HibernateException {
Session s = getSession();
try {
for (int i=0, l=confTypeIds.length; i<l; i++) {
s.delete(s.get(TConferenceType.class, new Integer(confTypeIds[i])));
}
} catch (HibernateException ex) {
errlog.error(ex);
throw ex;
}
}
Session s = getSession();
try {
for (int i=0, l=confTypeIds.length; i<l; i++) {
s.delete(s.get(TConferenceType.class, new Integer(confTypeIds[i])));
}
} catch (HibernateException ex) {
errlog.error(ex);
throw ex;
}
}
xml:
<action path="/deleteconftype"
type="com.kingstargroup.conference.action.DeleteConferenceTypeAction"
name="confTypeForm"
validate="false"
scope="request"
input="/html/conference/parameter/viewconftype.jsp">
<forward name="viewconftype" path="/html/conference/parameter/viewconftype.jsp"></forward>
</action>
type="com.kingstargroup.conference.action.DeleteConferenceTypeAction"
name="confTypeForm"
validate="false"
scope="request"
input="/html/conference/parameter/viewconftype.jsp">
<forward name="viewconftype" path="/html/conference/parameter/viewconftype.jsp"></forward>
</action>
errors:
Hibernate: select tconferenc0_.TYPE_ID as TYPE1_0_,
tconferenc0_.TYPE_NAME as TYPE2_7_0_, tconferenc0_.COMMENTS as
COMMENTS7_0_ from ykt_conf.T_CONFERENCE_TYPE tconferenc0_ where
tconferenc0_.TYPE_ID=?
java.lang.IllegalArgumentException: attempt to create delete event with null entity
at org.hibernate.event.DeleteEvent.<init>(DeleteEvent.java:25)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:578)
at com.kingstargroup.conference.dao.ConferenceTypeDAO.deleteConferenceType(ConferenceTypeDAO.java:35)
at com.kingstargroup.conference.util.ParameterUtil.deleteConferenceType(ParameterUtil.java:252)
at com.kingstargroup.conference.action.DeleteConferenceTypeAction.execute(DeleteConferenceTypeAction.java:29)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.extremecomponents.table.filter.AbstractExportFilter.doFilter(AbstractExportFilter.java:49)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.kingstargroup.conference.filter.SetEncodingFilter.doFilter(SetEncodingFilter.java:38)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
java.lang.IllegalArgumentException: attempt to create delete event with null entity
at org.hibernate.event.DeleteEvent.<init>(DeleteEvent.java:25)
at org.hibernate.impl.SessionImpl.delete(SessionImpl.java:578)
at com.kingstargroup.conference.dao.ConferenceTypeDAO.deleteConferenceType(ConferenceTypeDAO.java:35)
at com.kingstargroup.conference.util.ParameterUtil.deleteConferenceType(ParameterUtil.java:252)
at com.kingstargroup.conference.action.DeleteConferenceTypeAction.execute(DeleteConferenceTypeAction.java:29)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.extremecomponents.table.filter.AbstractExportFilter.doFilter(AbstractExportFilter.java:49)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.kingstargroup.conference.filter.SetEncodingFilter.doFilter(SetEncodingFilter.java:38)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
问题解决了!
问题是:eXtremeTable 在刷新页面时,将前一form提交的内容都作为hidden又全传了回来,且是不断累加的。
解决方法是:在转到新界面时,刷新界面,struts代码如下,注意着重部分:
<action path="/deleteconftype"type="com.kingstargroup.conference.action.parameter.DeleteConferenceTypeAction"
scope="request"
input="/html/conference/parameter/viewconftype.jsp">
<forward name="viewconftype" path="/viewconftype.do" redirect="true" ></forward>
</action>
发表评论
-
java.lang.ClassCastException: java.lang.Integer
2010-01-09 12:55 1387java.lang.ClassCastException: j ... -
Error:org.springframework.web.context.ContextLoaderListener
2010-01-06 21:17 8687Error con ... -
Error configuring application listener of class org.springframework.web.context.
2010-01-06 21:11 20119急!!tomcat启动报错:Error configuring ... -
Cannot find bean org.apache.struts.taglib.html.BEAN
2009-12-29 14:29 1304Cannot find bean org.apache.str ... -
懒加载异常org.hibernate.LazyInitializationException: could not initialize proxy - no
2009-12-28 20:44 20207错误页面提示 could n ... -
getHibernateTemplate.load() 和get()之间的区别
2009-12-28 20:16 18741. getHibernateTemplate.load() ... -
getSession()与getHibernateTemplate()区别
2009-12-28 20:13 2565getSession()与getHibernateTempla ... -
使用Hibernate持久层 --- 2 出现的问题与解决方法总结
2009-12-28 15:04 1207使用Hibernate持久层 --- 2 出现的问题与解决方法 ... -
java.lang.NullPointerException DAO
2009-12-28 15:02 1857~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... -
JSTL1.1中要用的jar--standard.jar jstl.jar
2009-12-09 00:35 4076gg -
Jsessionid
2009-12-07 16:22 1287(1) 这是一个 ... -
spring有三种启动方式,
2009-12-07 15:21 2471spring有三种启动方式,使用 ... -
ContextLoaderListener VS. ContextLoaderServlet
2009-12-07 15:20 3555一旦ContextLoaderServlet或Cont ... -
ERRORcheck whether you have multiple ContextLoader* definitions in your web.xml!
2009-12-07 15:17 6273ERROR:check whether you have mu ... -
从tomcat 迁移到 WebSphere 经验总结(修改)
2009-12-07 15:08 2456从tomcat 迁移到 WebSphere ... -
CGlib & asm
2009-12-07 15:01 2721缺少包出现的错误信息:cglib-2.1.3.jar CGL ... -
Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTup
2009-12-07 14:57 5441Unable to instantiate default t ... -
asm.jar的冲突问题
2009-12-07 14:53 1492No configuration found. Confi ... -
异常:ERROR [org.hibernate.proxy.BasicLazyInitializer] - CGLIB Enhancement failed..
2009-12-07 14:25 1814用MyEclipse6.0写了一个spri ... -
ssh 整合时报错java.lang.reflect.InvocationTargetException... 但是能运行起[
2009-12-07 14:17 11851内容太长(多次发): [Tomcat]2007-09-0 ...
相关推荐
Ionic框架是一款基于AngularJS和Apache Cordova的开源移动应用开发框架,它允许开发者使用Web技术(HTML、CSS、JavaScript)来构建跨平台的原生移动应用。在 Ionic 中,经常需要与用户交互处理日期和时间,这就需要...
Modified the SFX code (the code used to create the SFX stub distributed with VCLZip) so that it handles filenames that have been run through an OEM Conversion. The SFX was losing accented characters. ...
An attempt to read, understand, and implement the AUTOSAR SWS Port Driver according to the specification in a demo full-layered AUTOSAR a…
Over the years, I have been digging through large data sets both for work and pleasure. I love numbers, charts, graphs, visualizations, ...and visualizations become easier to create.
Easy Mobile is our attempt to create a many-in-one Unity package that greatly simplifies the implementation of de facto standard features of mobile games including advertising, in-app purchasing, game...
AT89C2051是一款8位微控制器,由美国Atmel公司生产,属于8051系列的单片机。它具有低功耗、高性能的特点,适用于各种嵌入式应用,包括工业控制、消费电子和家用电器等。RS232,则是一种常见的串行通信接口标准,用于...
orcad15.7 安装问题解决:An application has made an attempt to load the C runtime library incorrectly. Please ccontact the application"s support team for more information!
HeaderFooterGridView 头尾GridView 源码地址:ProjectX 介绍 支持AUTO_FIT模式,头尾模式有两种,无反射代码。 截图 先决条件 minSdkVersion 4 ...hfgContent.addHeaderItem(headerItem, null, true); hfgCont
《mksysb报错解决方法的详细指南》 在软件开发过程中,系统备份是确保数据安全和系统稳定性的重要步骤。然而,有时在执行mksysb命令进行系统备份时,可能会遇到各种报错,这可能对系统的正常运行造成影响。...
PB,全称PowerBuilder,是一种流行的面向对象的编程环境,主要用于开发企业级应用程序,特别是数据库应用。当你在尝试双击打开PB项目时遇到错误,这可能是由于多种原因引起的,包括注册表问题、软件版本不兼容、环境...
IN NO EVENT SHALL NVIDIA扴 AGGREGATE LIABILITY TO DEVELOPER OR ANY OTHER PERSON OR ENTITY CLAIMING THROUGH OR UNDER DEVELOPER EXCEED THE AMOUNT OF MONEY ACTUALLY PAID BY DEVELOPER TO NVIDIA FOR THE ...
How to query Databases with LINQ to SQL, write your own entity classes, and understand how to handle concurrency conflicts. Who this book is for This book is written for the proficient C# developer, ...
主要功能 进销存管理是企业日常经营管理中十分重要的一个组成部分,传统的手工管理方式呈现出越来越多的弊端。在手工管理模式下,统计、汇总处理时的工作量极其繁重,处理效率非常低,领导也无法及时了解企业资金...
This book is my attempt to share with the world the journey I’ve taken from “hack‐ ing” to “software engineering”. It’s mainly about testing, but there’s a lot more to it, as you’ll soon see....
SQL2570N 错误的全称是“An attempt to restore on target OS from a backup created on source OS failed due to the incompatibility of operating systems or an incorrect specification of the restore command...
Created function tryParseOffsetMessage to attempt to parse a kafka offset message retrieved from the internal committed offset topic: Handles messages of other types and questionable correctness. ...