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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to