Re: Another stupid question re: Interceptors
Hi all, then You have to state it: (pseudo code!) @Result(name='input', value='identify-success.jsp') in VerifyAction. But when it comes to action and result configuration best thing to do is: http://poulwiel.blogspot.com/2009/09/config-browser-plugin-in-struts2.html Best greetings, Paweł Wielgus. 2010/11/16 Greg Akins angryg...@gmail.com Maybe I'm doing something really stupid here. I have two pages / actions (IdentifyAction - identify-*.jsp - VerifyAction - verify-*.jsp) When a user completes the fields on identify-sucess.jsp and submits the form to VerifyAction.. the validate() method on VerifyAction fails. I want the user to be returned to identify-success.jsp to fix the appropriate fields. Am I doing this wrong? On Tue, Nov 16, 2010 at 4:17 PM, Gena Ganebnyi gganeb...@nebulent.com wrote: Why not to name your original page page-input.jsp? On Tue, Nov 16, 2010 at 10:31 PM, Greg Akins angryg...@gmail.com wrote: Does that mean that I can't use the Convention plugin if I want the Validation Interceptor to behave like I'm expecting? It seems like the information I've read so far implies that the Validator Interceptor will allow the submitting page to appear with the information filled in and the error messages displaying where appropriate. But if I follow the Convention plugin and use it's action/results then I don't get the same behavior. Am I missing something, or is this correct. On Tue, Nov 16, 2010 at 3:06 PM, Gena Ganebnyi gganeb...@nebulent.com wrote: When validation fails, intercept returns INPUT on behalf of the action. That is why convention plugin takes you to page-input.jsp On Nov 16, 2010 9:06 PM, Greg Akins angryg...@gmail.com wrote: I'm trying to get validation working.. should be pretty simple. It looks like if my validation fails Struts should auto-magically take me back to the originating jsp. Instead Struts keeps wanting to find a page-INPUT.jsp to match the INPUT return type. I'm using the convention plugin and using annotations, rather than validator.xml, for validations. Struts 2.2.1. There is no struts.xml file in the project (everything is through annotations.). Any hints? -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Another stupid question re: Interceptors
I suggest you to do these things in the following way: (1)put 2 method in IdentifyAction. The first [execute] method returns [input], show the input page to user. (2)In the Identify-input.jsp, submit fields to [IdentifyAction] itself, but another method: [verify] (3)when validation fails, the result will be [input] automatically, which means, the input page will be shown again. (4)when validation validation passes, your method [verify] will be executed. You can implement your business logic in it. If the verification fails, you can return a result [input], and back to the input page again. If the verification pass, you can return another result, and forward(or redirect) to the next action; or you can return a result [success], show the Identify-success.jsp page. (5)another thing need to notice is, method [execute] should be marked by [skipvalidation] annotation - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Another stupid question re: Interceptors
On Wed, Nov 17, 2010 at 8:14 AM, Li Ying liying.cn.2...@gmail.com wrote: I suggest you to do these things in the following way: This is where I think I messed things up. My identifyAction didn't have setters/getters for the fields because the verifyAction captured the results of that input. Consequently, when I redirected to IdentifyAction to get the identify-success.jsp, the values COULDN'T be available. (Doh!!) You're suggestion below sounds much more reasonable though. Thanks for everyone's help and patience. (1)put 2 method in IdentifyAction. The first [execute] method returns [input], show the input page to user. (2)In the Identify-input.jsp, submit fields to [IdentifyAction] itself, but another method: [verify] (3)when validation fails, the result will be [input] automatically, which means, the input page will be shown again. (4)when validation validation passes, your method [verify] will be executed. You can implement your business logic in it. If the verification fails, you can return a result [input], and back to the input page again. If the verification pass, you can return another result, and forward(or redirect) to the next action; or you can return a result [success], show the Identify-success.jsp page. (5)another thing need to notice is, method [execute] should be marked by [skipvalidation] annotation -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Another stupid question re: Interceptors
I'm trying to get validation working.. should be pretty simple. It looks like if my validation fails Struts should auto-magically take me back to the originating jsp. Instead Struts keeps wanting to find a page-INPUT.jsp to match the INPUT return type. I'm using the convention plugin and using annotations, rather than validator.xml, for validations. Struts 2.2.1. There is no struts.xml file in the project (everything is through annotations.). Any hints? -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Another stupid question re: Interceptors
When validation fails, intercept returns INPUT on behalf of the action. That is why convention plugin takes you to page-input.jsp On Nov 16, 2010 9:06 PM, Greg Akins angryg...@gmail.com wrote: I'm trying to get validation working.. should be pretty simple. It looks like if my validation fails Struts should auto-magically take me back to the originating jsp. Instead Struts keeps wanting to find a page-INPUT.jsp to match the INPUT return type. I'm using the convention plugin and using annotations, rather than validator.xml, for validations. Struts 2.2.1. There is no struts.xml file in the project (everything is through annotations.). Any hints? -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Another stupid question re: Interceptors
Why not to name your original page page-input.jsp? On Tue, Nov 16, 2010 at 10:31 PM, Greg Akins angryg...@gmail.com wrote: Does that mean that I can't use the Convention plugin if I want the Validation Interceptor to behave like I'm expecting? It seems like the information I've read so far implies that the Validator Interceptor will allow the submitting page to appear with the information filled in and the error messages displaying where appropriate. But if I follow the Convention plugin and use it's action/results then I don't get the same behavior. Am I missing something, or is this correct. On Tue, Nov 16, 2010 at 3:06 PM, Gena Ganebnyi gganeb...@nebulent.com wrote: When validation fails, intercept returns INPUT on behalf of the action. That is why convention plugin takes you to page-input.jsp On Nov 16, 2010 9:06 PM, Greg Akins angryg...@gmail.com wrote: I'm trying to get validation working.. should be pretty simple. It looks like if my validation fails Struts should auto-magically take me back to the originating jsp. Instead Struts keeps wanting to find a page-INPUT.jsp to match the INPUT return type. I'm using the convention plugin and using annotations, rather than validator.xml, for validations. Struts 2.2.1. There is no struts.xml file in the project (everything is through annotations.). Any hints? -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre
Re: Another stupid question re: Interceptors
Maybe I'm doing something really stupid here. I have two pages / actions (IdentifyAction - identify-*.jsp - VerifyAction - verify-*.jsp) When a user completes the fields on identify-sucess.jsp and submits the form to VerifyAction.. the validate() method on VerifyAction fails. I want the user to be returned to identify-success.jsp to fix the appropriate fields. Am I doing this wrong? On Tue, Nov 16, 2010 at 4:17 PM, Gena Ganebnyi gganeb...@nebulent.com wrote: Why not to name your original page page-input.jsp? On Tue, Nov 16, 2010 at 10:31 PM, Greg Akins angryg...@gmail.com wrote: Does that mean that I can't use the Convention plugin if I want the Validation Interceptor to behave like I'm expecting? It seems like the information I've read so far implies that the Validator Interceptor will allow the submitting page to appear with the information filled in and the error messages displaying where appropriate. But if I follow the Convention plugin and use it's action/results then I don't get the same behavior. Am I missing something, or is this correct. On Tue, Nov 16, 2010 at 3:06 PM, Gena Ganebnyi gganeb...@nebulent.com wrote: When validation fails, intercept returns INPUT on behalf of the action. That is why convention plugin takes you to page-input.jsp On Nov 16, 2010 9:06 PM, Greg Akins angryg...@gmail.com wrote: I'm trying to get validation working.. should be pretty simple. It looks like if my validation fails Struts should auto-magically take me back to the originating jsp. Instead Struts keeps wanting to find a page-INPUT.jsp to match the INPUT return type. I'm using the convention plugin and using annotations, rather than validator.xml, for validations. Struts 2.2.1. There is no struts.xml file in the project (everything is through annotations.). Any hints? -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre -- Greg Akins http://insomnia-consulting.org http://www.pghcodingdojo.org http://pittjug.dev.java.net http://twitter.com/akinsgre http://www.linkedin.com/in/akinsgre - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org