claym wrote:
One of the things I really liked about Spring MVC was the fact that it was
very easy to control the flow of a request. You could use referenceData() to
add data that was needed on the page but not necessarily form related, then
formBackingObject() for the actual pre-submission form population, and then
control the processing of pre-submit and post-submit with showForm() and
onSubmit()

It was also smart enough to repopulate things like referenceData if there
was an invalid submission.

Part of this was due to the fact that there were lots of different types of
controllers - all the referenceData and formBackingObject wasn't necessary
if you're just displaying a non-form page, but you could always use
SimpleFormController if you needed it.

I'm not seeing that kind of behavior in Struts 2. I'm not saying it's
required functionality, but I certainly appreciated it in Spring MVC.

Is it there and I'm not seeing it? How would you control the request like
this?

I don't know SpringMVC at all, but this all sounds like stuff that's easy to do with Struts2, as far as I understand your description.

Firstly, anything you expose via a getter method in your action is available from the page template, which I think takes care of the referenceData part. Perhaps also take a look at the Preparable interceptor and associated Preparable interface.

You can also use action getters for form population but if you prefer to keep the form related data separate you can. Either have a getter on the action that returns a reference to an object which holds the form data or, if you want to make things more explicit, you can use the Model Driven pattern (implementing a getModel() method on your action).

Doing different processing when showing the form vs. handling its submission is easy: put the logic in two different action methods. You can have one method invoked to display the form and invoke the other to processes it when submitted. You can also easily invoke a different method for each 'submit' button on the form if you need to.

Struts also knows how to automatically redisplay the input form if it's submitted with invalid data. With appropriate configuration, you can invoke the same logic you used to setup the form in the first place to provide that data that wasn't 'form related'.

I would suggest trying a simple test app to experiment with these workflows and coming back with specific questions. It's difficult to generalize about Struts equivalents to the features of an unfamiliar framework :-)

L.


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

Reply via email to