日期:2014-05-17  浏览次数:20817 次

高手进,求实质性的解决方案SSH 提交问题
本帖最后由 qq237121087 于 2013-10-20 14:39:21 编辑

问题 :JSP 提交过去的时候出现如上图错误,进Action之前就出现的。但是其他的查询删除方法都没问题的!
//JSP代码如下
<s:form id="form" name="humanfileForm" method="post" action="zhaoping!saveZw"  theme="simple">
//此次代码省略
<s:form>
//Struts xml 配置如下
<package name="struts" namespace="/" extends="struts-default">
<!-- 职位发布管理Action -->
<action name="zhaoping" class="action.zhaoping.Action_ZaoPing">
<result>/page/recruit/position/position_register.jsp</result>
<result name="zwdjlist">/page/recruit/position/position_change_update.jsp</result>
<result name="zwdjById">/page/recruit/position/position_release_change.jsp</result>
<result name="select">/page/recruit/position/position_release_search.jsp</result>
<result name="zwdjById1">/page/recruit/position/position_release_details.jsp</result>
<!-- 简历管理Action -->
<result name="Jl">/page/recruit/resume/register.jsp</result>
<result name="Jl_ShaiXun">/page/recruit/resume/resume-choose.jsp</result>
</action>
</package>

//Action 代码如下
public String saveZw() throws Exception{
String f = service.ZwAdd(emajorRelease);
System.out.println(emajorRelease.getChangeTime()+"--");
HttpServletResponse response = ServletActionContext.getResponse(); 
response.setContentType("text/html;charset=UTF-8");
PrintWriter pw = response.getWriter(); 
if(f=="true"){
pw.write( "<script>alert('成功登记');</script>"); 
}else{
pw.write( "<script>alert('失败登记');</script>"); 
}
return null;
}

//Spring 事务配置如下
<!-- 需要事务的方法的名称 注意:以后service 方法的名称跟这里有关联 -->
<tx:advice id="advice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="zhuan*" propagation="REQUIRED"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="delZwDj*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>

<!-- 配置切入点 -->
<aop:config>  <!--以后要配置事务 只需要修改这里的包名就可以了 -->
<aop:pointcut expression="execution(* service.*.*.*(..))" id="allservice"/>
<aop:advisor advice-ref="advice" pointcut-ref="allservice"/>
</aop:config>
解决方案 string 事务

------解决方案--------------------