Hello Don, Thank you very much for your response and yes <s:submit method="processMyForm" ... works quite well. Nevertheless, I would like to see a more RESTful behavior implemented into Struts2 for the actions.
Don, what would be the best way to proceed from here. As a start shall I go ahead and open a feature Request in Jira? How can I help otherwise? Thanks - Gunnar PS: I look very briefly at JSR-311. IT seems to be still in very early stages (Formed in February'07). Also, I am not sure if we would need much more than the @HttpMethod(GET) @HttpMethod(POST) etc. annotations. Don Brown wrote: > > As it is, yes and no. You can use the restful2 action mapper to have > struts "guess" what the method names should be based on the URI and > the HTTP method. However, outside that, I'm guessing you are really > wanting some sort of technique that reads, say, an annotation over a > method that says that this method should only be called when the HTTP > method is, say, "PUT". Right now, there is no such feature, however, > I'm very interested in supporting something like that, particularly if > it uses the recent Restful JSR annotations the the JCP is working on. > > Don > > On 5/11/07, Gunnar Hillert <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Thanks for your quick response. I will take a look at this. But my >> question is: can I configure my actions in a way/somehow that they >> execute different methods when called through different HTTP methods >> e.g. GET, POST maybe even DELETE. >> >> Call the action's input method if it is a GET, call the execute method >> if it is a POST. (Maybe you can even call it 'restful form handling' :-) >> >> Anyway, I have to look into your suggestion as well - >> >> Thanks again! >> >> Cheers, >> >> Gunnar >> >> >> >> HTTP methods are * <http://en.wikipedia.org/wiki/Http>* >> >> >> Don Brown wrote: >> > <div class="moz-text-flowed" style="font-family: -moz-fixed">Yep, that >> > should work almost exactly as you describe, although what I >> > would do is use a single action definition. You can specify exactly >> > what method to call either in the URL (via the action!method.action >> > syntax) or in your action definition. Say you make the default case >> > be "input" in your action definition, but then when submitting the >> > form, set the "method" attribute on the submit button to ensure that >> > the submitted form calls the editUser method. Incidentally, the >> > validation interceptor is pre-configured to not validate when the >> > "input" method is called, but tries to validate anything else. >> > >> > Don >> > >> > On 5/11/07, Gunnar Hillert <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> >> >> I worked with Spring-MVC in my past projects and I really liked the >> idea >> >> of my form actions/controllers to initialize my forms when I access >> them >> >> with an HTTP GET and then process the forms with an HTTP POST. The >> nice >> >> effect of this is that I have one single URL that does form >> >> initialization as well as processing the form. >> >> >> >> See for more details on how Spring MVC is doing it: >> >> >> http://www.springframework.org/docs/api/org/springframework/web/servlet/mvc/AbstractFormController.html >> >> >> >> >> >> >> >> Can I do something similar in Struts2? >> >> >> >> It would be great if I could do something like this (May not make >> total >> >> sense but I hope to convey my intent): >> >> >> >> <action name="editUser" http-method="GET" method="input"> (no >> >> validation) >> >> <result name="success">/editUser.jsp</result> >> >> </action> >> >> <action name="editUser" http-method="POST" method="editUser"> >> >> (validate form and process) >> >> <result name="input">/editUser.jsp</result> >> >> <result name="success" type="redirect">/main.html</result> >> >> </action> >> >> >> >> Thanks a lot for any insights! >> >> >> >> Regards, >> >> >> >> Gunnar Hillert >> >> >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > </div> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/-S2--Form-handling-life-cycle-with-HTTP-GET-POST-tf3722563.html#a10801945 Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]