Tuesday, June 7, 2011

Struts2 navigate away from error pages

Struts 2 provides a nice workflow interceptor that makes sure there are no validation errors before allowing the interceptor chain to continue.

This will also prevent the user from navigating away to a different method in the same action. Sometimes that is not the desired behavior we like. For example, if the user is editing an item and there is a validation error and the user does not want to fix the validation error, however they choose to navigate to a different page on the same action, the workflow interceptor will prevent the user and put them back to the edit page.

If the desired behavior is to let them proceed to to another page, you can exclude those methods in the interceptor configuration similar to the following example.
<interceptor-ref name="defaultLoginStack" >
         <param name="validation.excludeMethods">doInput,doList</param>
         <param name="workflow.excludeMethods">doInput,doList</param>
</interceptor-ref>
In the above example, if the user tries to access the doList or doInput methods the validation will be skipped and the workflow will allow to continue even if the previous page had errors.

4 comments:

Lilla Wilkinson said...

Professional writers of one of the best custom writing college papers services 2021 will start working on your order once payment is through. We don’t write free papers, however, we write affordable papers that reach academic goals that you set us to meet.

buy dissertation said...

Only 100% unique and quality papers. Our Quality Assurance Team checks every paper for sale for plagiarism and consistency before final delivery. You are guaranteed to receive an entirely cheap research papers original piece with properly cited sources.

Kevenjohn said...

Great Blog.If you are students,and you have no time to complete their assignment on the given timeline.We have a team of a professional content writer,that is available 24/7 to help the students.We are offering an online debate topics uk at a cheap price.

Whome1996 said...

At some point, you will get tired of studying and there will be burnout, which will lead to poor grades, but fortunately, there is where to buy an essay, helps in writing, performs any written work to order quickly and efficiently