开发者

JSP Struts2 error that I cannot figure out on a basic Contact Manager app

开发者 https://www.devze.com 2023-03-11 09:09 出处:网络
I am trying to do the tutorial at this website and I ran into this exception right at the point where I try to ADD a contact to the database by hitting the submit button.I am looking for some advice o

I am trying to do the tutorial at this website and I ran into this exception right at the point where I try to ADD a contact to the database by hitting the submit button. I am looking for some advice on how to troubleshoot this? I have to admit that I don't know anything about this opensymphony.xwork2 stuff.

No result defined for action my.contact.view.ContactAction and result input 
    com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:264)
    com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
    org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:235)
    com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
    com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:235)

If you want to download and try my code, her开发者_开发技巧e is the Eclipse project, all zipped up: http://djangofan.blogsite.org/wordpress/wp-content/uploads/StrutsHibernate.7z


As Steven has mentioned, if a validation or type conversion error occurs, INPUT gets returned if you're using the default interceptor stack, which would bypass your expected action code and look for the configured INPUT result. So it could be a validation issue or it could be the entire app is misconfigured if you do have an INPUT result defined on the add action.

I skimmed the tutorial and would suggest starting fresh with one of the Struts 2 Maven archetypes or using one of the Struts 2 showcase projects as a starter instead. In J2EE land you don't want to be manually managing your own jar versions & dependencies. Also, the code in the tutorial has some issues, for example, the current Struts 2 documentation explicitly states that action chaining isn't recommended and that you should just use a simple redirect type instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消