`

jquery和struts2整合ajax提交form的问题

阅读更多
1.提交的时候.老是提示下载文件.
找了很多 还是未解决

用了一个替代的方法. 使用jquery.form来提交

用jquery.form提交的时候,遇到了.回调函数不调用的问题.
找了很久.最终想到一个办法.将参数都拼起来,然后提交到服务端,看是否能返回数据.
结果保存.原来是服务端出问题了.
Struts Problem Report
Struts has detected an unhandled exception:

Messages: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"

File: sun/reflect/Reflection.java
Line number: 65


--------------------------------------------------------------------------------

Stacktraces
org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
    org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:230)
    org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
    org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
    org.apache.struts2.json.JSONWriter.write(JSONWriter.java:94)
    org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:115)
    org.apache.struts2.json.JSONResult.createJSONString(JSONResult.java:200)
    org.apache.struts2.json.JSONResult.execute(JSONResult.java:172)
    com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:373)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:270)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:619)
   
org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
    org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:230)
    org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
    org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
    org.apache.struts2.json.JSONWriter.add(JSONWriter.java:352)
    org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:215)
    org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
    org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
    org.apache.struts2.json.JSONWriter.write(JSONWriter.java:94)
    org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:115)
    org.apache.struts2.json.JSONResult.createJSONString(JSONResult.java:200)
    org.apache.struts2.json.JSONResult.execute(JSONResult.java:172)
    com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:373)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:270)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:619)
   
org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: java.lang.IllegalAccessException: Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
    org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:230)
    org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
    org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
    org.apache.struts2.json.JSONWriter.array(JSONWriter.java:472)
    org.apache.struts2.json.JSONWriter.process(JSONWriter.java:148)
    org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
    org.apache.struts2.json.JSONWriter.add(JSONWriter.java:352)
    org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:215)
    org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
    org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
    org.apache.struts2.json.JSONWriter.add(JSONWriter.java:352)
    org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:215)
    org.apache.struts2.json.JSONWriter.process(JSONWriter.java:160)
    org.apache.struts2.json.JSONWriter.value(JSONWriter.java:126)
    org.apache.struts2.json.JSONWriter.write(JSONWriter.java:94)
    org.apache.struts2.json.JSONUtil.serialize(JSONUtil.java:115)
    org.apache.struts2.json.JSONResult.createJSONString(JSONResult.java:200)
    org.apache.struts2.json.JSONResult.execute(JSONResult.java:172)
    com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:373)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)
    com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:270)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498)
    org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:619)
   

=============================================
貌似是序列化的问题.

原来我偷懒,注入的manager也被序列化了.

加上
@JSON(serialize=false)
public PrdManager getPrdManager() {
return prdManager;
}
就ok了

------------------------------------

==============include.jsp==============
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<link href="/SCM/ui/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<script src="/SCM/ui/jquery/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="/SCM/ui/jquery-plugins/jquery.form.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerMenu.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerTab.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerAccordion.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerTree.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerWindow.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
   
    <script src="/SCM/ui/ligerUI/js/plugins/ligerNoSelect.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
    <script src="/SCM/ui/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
   


========================nirvana_input.jsp========================
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>添加商品</title>
   
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">   
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<jsp:include page="/nirvana/include.jsp"></jsp:include>

<script type="text/javascript"> 
  $(function(){ 
       /**$("#saveGoodBtn").click(function(){ 
                var params=$('#goodAddForm').formSerialize(); //这里直接就序列化了表单里面的值;很方便    
                params = decodeURIComponent(params,true);
                var url="/SCM/pro/proAction!goodsadd.action";
                jQuery.post(url, params, callbackFun, 'json');
        })**/
       
        var options = {
        target:        '#output2',   // target element(s) to be updated with server response
        beforeSubmit:  showRequest,  // pre-submit callback
        success:       showResponse,  // post-submit callback
        type:          'post',
        dataType:      'json'

        // other available options:
        //url:       url         // override for form's 'action' attribute
        //type:      type        // 'get' or 'post', override for form's 'method' attribute
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type)
        //clearForm: true        // clear all form fields after successful submit
        //resetForm: true        // reset the form after successful submit

        // $.ajax options can be used here too, for example:
        //timeout:   3000
       };
       
        $('#goodAddForm').submit(function() {   
         // submit the form   
         $(this).ajaxSubmit(options);   
         // return false to prevent normal browser submit and page navigation   
         return false;
        });  
       
       
        function showRequest(formData, jqForm, options) {
    // formData is an array; here we use $.param to convert it to a string to display it
    // but the form plugin does this for you automatically when it submits the data
    var queryString = $.param(formData);

    // jqForm is a jQuery object encapsulating the form element.  To access the
    // DOM element for the form do this:
    // var formElement = jqForm[0];
   //var other = document.getElementById("other");
   //other.setValue(queryString);
   alert($("#other").val());
   $("#other").val(queryString);
    alert('About to submit: \n\n' + queryString);

    // here we could return false to prevent the form from being submitted;
    // returning anything other than false will allow the form submit to continue
    return true;
}

// post-submit callback
function showResponse(responseText, statusText, xhr, $form)  {
    // for normal html responses, the first argument to the success callback
    // is the XMLHttpRequest object's responseText property

    // if the ajaxSubmit method was passed an Options Object with the dataType
    // property set to 'xml' then the first argument to the success callback
    // is the XMLHttpRequest object's responseXML property

    // if the ajaxSubmit method was passed an Options Object with the dataType
    // property set to 'json' then the first argument to the success callback
    // is the json data object returned by the server

    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
        '\n\nThe output div should have already been updated with the responseText.');
}
       
       
         function callbackFun(res){ 
            alert("保存,返回提示信息!"+res.messageType); 
         }
   })

  </script> 

  </head>
 
  <body>
   
    
     <form action="/SCM/pro/proAction!goodsadd.action" id="goodAddForm" method="post">
      <table>
          <tr>
             <td>类目id</td><td><input type="text"  name="goods.catagory_uid" id="catagory_uid" ></td>
             <td>商品编号</td><td><input type="text"  name="goods.goods_code" id="goods_code" ></td>
             <td></td><td></td>
          </tr>
          <tr>
             <td>商品名称</td><td><input type="text"  name="goods.goods_name" id="goods_name" ></td>
             <td>采购价</td><td><input type="text"  name="goods.prime_price" id="prime_price" ></td>
             <td>销售价</td><td><input type="text"  name="goods.sale_price" id="sale_price" ></td>
          </tr>
          <tr>
              <td>是否多规格</td>
              <td><input type="text" name="goods.ismutil" id="ismutil" value="0"/> </td>
              <td>状态</td>
              <td><input type="text" name="goods.status" id="status" value="1"/> </td>
              <td><input type="text"  id="other" value="1"/> </td>
          </tr>
         
      </table>
        <br> 
        <input type="submit"  value="提交2" id="saveGoodBtn" ><br> 
      </form>
    
   
  </body>
</html>



===================ProAction.java=================
/**
*
*/
package com.bstek.scm.action.nirvana;

import java.util.List;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.json.annotations.JSON;

import com.bstek.scm.bo.prd.PrdManager;
import com.bstek.scm.common.exception.ManagerException;
import com.bstek.scm.common.tools.LogFactory;
import com.bstek.scm.pojo.prd.Goods;

/**
* @author fengbin
* @createDate Aug 19, 2011 9:06:48 PM 
*/
public class ProAction {


private PrdManager prdManager;
private String jsonResult; 
private List<Goods> goodsList;
private Goods goods;
//处理结果消息
private String messageType;
/**
* 商品添加
* @return
*/
public String goodsadd(){

try {
prdManager.saveGoods(goods);
messageType="ok";
ServletActionContext.getResponse().setContentType("text/html");
} catch (ManagerException e) {
LogFactory.errLog.error("商品添加出错!",e);
}

return "success";

}
   
@JSON(serialize=false)
public PrdManager getPrdManager() {
return prdManager;
}

public void setPrdManager(PrdManager prdManager) {
this.prdManager = prdManager;
}

public String getJsonResult() {
return jsonResult;
}

public void setJsonResult(String jsonResult) {
this.jsonResult = jsonResult;
}

public List<Goods> getGoodsList() {
return goodsList;
}

public void setGoodsList(List<Goods> goodsList) {
this.goodsList = goodsList;
}

public Goods getGoods() {
return goods;
}

public void setGoods(Goods goods) {
this.goods = goods;
}

public String getMessageType() {
return messageType;
}

public void setMessageType(String messageType) {
this.messageType = messageType;
}



}


=======================struts.xml====================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>

    <!--  <include file="struts-default.xml"/> -->
<!-- 是否显示详细错误信息 -->
<constant name="struts.devMode" value="true" />
<!-- 国际化资源文件名称 -->
<constant name="struts.custom.i18n.resources" value="i18n" />
<!-- 是否自动加载国际化资源文件  -->
<constant name="struts.i18n.reload" value="false" />
<!-- convention类重新加载 -->
<constant name="struts.convention.classes.reload" value="false" />
<!-- 浏览器是否缓存静态内容 -->
<constant name="struts.serve.static.browserCache" value="false" />
<!-- 配置使用Spring管理Action -->
<constant name="struts.objectFactory" value="spring" />
<!-- 上传文件大小限制设置 -->
<constant name="struts.multipart.maxSize" value="-1" />

<!-- 主题 -->
<constant name="struts.ui.theme" value="simple" />
<!-- 编码 -->
<constant name="struts.i18n.encoding" value="UTF-8" />
<!-- 后缀 -->
<constant name="struts.action.extension" value="action" />

<!-- 结果资源的路径 -->
<constant name="struts.convention.result.path" value="/web/" />
<!-- URL资源分隔符 -->
<constant name="struts.convention.action.name.separator" value="_" />
<!-- spring 缓存机制 -->
<constant name="struts.objectFactory.spring.useClassCache" value="false"/>

<package name="basePackage" extends="struts-default">
<interceptors>
<interceptor-stack name="baseStack">
                <interceptor-ref name="exception" />
                <interceptor-ref name="alias" />
                <interceptor-ref name="servletConfig" />
                <interceptor-ref name="i18n" />
                <interceptor-ref name="prepare" />
                <interceptor-ref name="chain" />
                <interceptor-ref name="debugging" />
                <interceptor-ref name="scopedModelDriven" />
                <interceptor-ref name="modelDriven" />
                <interceptor-ref name="fileUpload" />
                <interceptor-ref name="checkbox" />
                <interceptor-ref name="multiselect" />
                <interceptor-ref name="staticParams" />
                <interceptor-ref name="actionMappingParams" />
                <interceptor-ref name="params">
<param name="excludeParams">dojo\..*,^struts\..*</param>
                </interceptor-ref>
                <interceptor-ref name="conversionError"/>
                <!-- 配置方法级别的校验 -->
                <interceptor-ref name="validation">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                    <param name="validateAnnotatedMethodOnly">true</param>
                </interceptor-ref>
                <interceptor-ref name="workflow">
                    <param name="excludeMethods">input,back,cancel,browse</param>
                </interceptor-ref>
            </interceptor-stack>
</interceptors>

<!-- 配置默认拦截器栈 -->
<default-interceptor-ref name="baseStack" />

<!-- 未到找Action指向页面 -->
<default-action-ref name="errorPage" />

<action name="errorPage">
<result type="redirect">/html/error_page_404.html</result>
</action>
</package>

<!-- 涅磐 action -->
<package name="nirvana" extends="basePackage" namespace="/nirvana">
        <action name="nirvanaAction" class="nirvanaAction">
    <result name="userlogin">/nirvana/nirvana_userlogin.jsp</result>
    <result name="test">/nirvana/nirvana_test.ftl</result>
    <result name="list">/nirvana/nirvana_list.jsp</result>
</action>
    </package>
   
    <!-- json 测试action -->
    <package name="json" extends="struts-default,json-default" namespace="/json"> 
            <action name="jsonAction" class="jsonAction"> 
                <interceptor-ref name="params"/> 
                <result type="json">
                   <!--   <param name="root">jsonResult</param> -->
                      <param name="includeProperties">
                       goodsList\[\d+\]\.goods_uid,goodsList\[\d+\]\.goods_name
</param>
                </result> 
            </action> 
           
            <action name="goodAddAction" class="jsonAction">
               <result type="json"></result>
            </action>
    </package> 
   
    <package name="ajax" extends="json-default" namespace="/ajax">
        <action name="ajaxRequest"
            class="com.bstek.scm.action.nirvana.HelloWorld">
            <result type="json"></result>
        </action>
    </package>
   
    <package name="pro" extends="json-default" namespace="/pro">
        <action name="proAction" class="proAction">
            <result type="json"></result>
        </action>
    </package>
   
    <package name="S2SHJQuery" extends="json-default"> 
<action name="show" class="com.bstek.scm.action.nirvana.ShowAction"> 
<result type="json"/> 
</action> 
</package> 




</struts>

==========spring配置文件 nirana-context.xml==============
<?xml version="1.0" encoding="UTF-8"?>
<beans default-autowire="autodetect" xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<!-- struts2action  -->
<bean id="nirvanaAction"   class="com.bstek.scm.action.nirvana.NirvanaAction" scope="prototype">
   <property name="prdManager">
      <ref bean="prdManager"/>
   </property>
</bean>

    <!-- json action配置 -->
    <bean id="jsonAction" class="com.bstek.scm.action.nirvana.JsonAction" scope="prototype">
         <property name="prdManager">
        <ref bean="prdManager"/>
     </property>
    </bean>
   
    <bean id="proAction"  class="com.bstek.scm.action.nirvana.ProAction" scope="prototype">
         <property name="prdManager">
        <ref bean="prdManager"/>
     </property>
    </bean>

</beans>


分享到:
评论

相关推荐

    jquery和struts2的整合

    通过运行这个Demo,你可以看到jQuery与Struts2整合的实际效果,如Ajax提交表单、动态更新页面等。 总之,jQuery与Struts2的整合使得前端交互更为便捷,同时保持了Struts2的MVC架构和强大的后端控制能力。在实际开发...

    struts2+ajax+jquery

    在这个"struts2+ajax+jquery"的主题中,我们将深入探讨如何利用Struts2、jQuery和Ajax技术实现Web页面的异步交互。 首先,Struts2作为MVC框架,它的核心是Action,它负责处理用户的请求,并通过配置的Result返回...

    jquery与struts2整合

    将jQuery与Struts2整合可以使前端与后端的数据交互变得更加高效和便捷。下面我们将详细讲解如何实现这一整合。 **1. 环境配置** 在整合jQuery和Struts2之前,我们需要确保所有的依赖库已经正确地引入到项目中。关键...

    Struts2整合jQuery实现Ajax功能

    ### Struts2整合jQuery实现Ajax功能 #### 一、引言 随着Web应用程序的发展,用户对交互性和响应速度的要求越来越高。传统的Web表单提交方式已无法满足这些需求,因此Ajax技术逐渐成为提升用户体验的重要手段之一。...

    整合了struts2 jquery的formValidator表单验证的页面代码

    这个项目中的代码示例可以作为学习和参考,帮助开发者理解如何在实际项目中整合Struts2和jQuery的formValidator,提高表单验证的效率和用户体验。对于初学者来说,深入研究这个示例有助于掌握Struts2和jQuery在实际...

    jquery + struts1 + ajax学习例子

    例如,当你在前端使用jQuery监听用户事件,如表单提交,然后通过Ajax发送请求,Struts1的Action接收到请求后处理业务逻辑,最后Ajax回调函数根据服务器返回的数据更新页面。这样的流程避免了页面的完全刷新,提高了...

    Struts2+Jquery+Ajax

    8. 实例演示:使用Struts2+Jquery+Ajax实现动态加载数据或表单验证 "struts2 jar"文件包含了Struts2框架的核心库,可能包括struts2-core、struts2-convention、struts2-json-plugin等依赖,这些是开发Struts2应用必...

    struts2+ajaxForm

    结合以上内容,我们可以看到Struts2和AjaxForm的集成使得Web应用在处理表单数据时更加高效,同时jQuery和validate插件的使用则确保了表单数据的质量,提供了更好的用户体验。在实际开发中,这样的组合可以大大提高...

    struts2ajax项目

    在Struts2框架中整合Ajax,可以实现异步数据交互,提高应用的响应速度和交互性。 本项目"struts2ajax"是基于Struts2框架,利用jQuery库实现的Ajax功能示例。jQuery是一个轻量级的JavaScript库,它简化了DOM操作、...

    Jquery 整合 struts2 完整例子

    在IT行业中,jQuery和Struts2是两种非常重要的技术,它们分别在前端和后端扮演着关键角色。这里我们探讨的是如何将这两种技术整合到一起,创建一个完整的Web应用程序实例。我们将详细介绍这个"Jquery 整合 struts2 ...

    struts2+json+jquery实现ajax数据的存取

    通过以上步骤,"Struts2+JSON+jQuery实现Ajax数据的存取"能够有效地提高Web应用的交互性和响应速度,使得用户在不刷新整个页面的情况下,也能获取并处理服务器的新数据。在实际项目中,这通常用于实现表格数据的分页...

    Struts 2整合Ajax开发

    这只是一个简单的示例,实际上,Struts 2和Ajax的整合可以实现更复杂的功能,如分页、数据表格的异步加载、实时验证等。整合这两者,开发者可以构建出既高效又具有交互性的Web应用,提供更好的用户体验。在实际项目...

    JQuery EasyUI 整合struts2 代码下载

    标题 "JQuery EasyUI 整合struts2 代码下载" 涉及到的是一个Web开发中的技术组合,主要集中在前端的JQuery EasyUI框架与后端的Struts2框架的集成应用。JQuery EasyUI是一个基于jQuery的UI库,提供了丰富的组件,如...

    struts2+jquery+ajax文件异步上传

    Struts2、jQuery和Ajax是Web开发中的三个关键组件,它们共同构成了文件异步上传的基础框架。这个项目是在MyEclipse环境下实现的一个简单的文件上传功能,让我们深入了解一下这些技术及其在文件上传中的应用。 首先...

    struts2+jquery+json+ajax例子

    Struts2、jQuery、JSON和Ajax是Web开发中常见的技术栈,它们共同为构建动态、交互式的用户界面提供了强大的支持。下面将详细解释这些技术及其在登录示例中的应用。 Struts2是一个基于MVC(Model-View-Controller)...

    Struts-Ajax整合案例

    综上所述,Struts2和AJAX的整合是提高Web应用交互性和效率的有效手段。通过理解它们的基本原理和整合方法,开发者可以创建出更高效、更具吸引力的Web应用。在实际开发中,还需要不断学习和实践,以便更好地应对各种...

    整合jquery+json+struts2异步提交实例

    在这个实例中,“整合jquery+json+struts2异步提交”是一个典型的前端与后端交互的示例,利用了jQuery的Ajax功能和Struts2框架处理JSON数据。下面我们将详细探讨这些技术及其相互配合的工作原理。 **jQuery** 是一...

    Struts2整合jQuery实现Ajax功能_demo

    本文将详细解析如何通过Struts2框架整合jQuery来实现Ajax功能,具体涉及的知识点包括:Struts2框架基础、jQuery库的应用、Ajax原理以及具体的代码示例分析。 ### Struts2框架基础 Struts2是一个基于MVC(Model-...

    省市联动jquery+struts2

    标题中的“省市联动jQuery+Struts2”是指在Web开发中使用jQuery库和Struts2框架实现的一个功能,即当用户选择一个省份时,相关的城市会动态地在下拉列表中加载出来,提供用户选择。这个功能在很多需要收集用户地址...

    struts2对AJAX的支持

    可以使用Struts2的AJAX验证功能,实现表单字段的实时验证,无需提交整个表单即可检查输入的有效性。 8. **AJAX分页**: 对于需要分页显示的数据,Struts2 jQuery插件提供了`sj:tabbedpanel`和`sj:datatables`等...

Global site tag (gtag.js) - Google Analytics