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]

Reply via email to