So I'm done banging my head against my monitor:
What is the simplest way to display a confirmation web page?
For example, a user submits a form that updates the database. Upon success, I want to redirect the user to a very basic view that displays some text info:
- what you did worked (or did not work)
- here's where you can go now: [link] or [link] or [link].
The text displayed would depend on what the user did, of course.
I can't figure out how to do this.
Here are the parts:
I've got a Result class with two
String fields:
I've got a form controller with an onSubmit that processes the user submit:
I've got a ResultController, but I don't really know what to put in there. It's a SimpleFormController, but the view isn't a form, so is that what I should use? No formBackingObject method.
The ResultController bean in servlet.xml is:
There's nothing in myResult.jsp but some JSTL expressions:
So this runs, except the resulting page is blank. I know there is data in the Result object, because the log tells me so.
So:
- I suspect this isn't the simplest way to do it, but i couldn't figure out how to use any of the non-form controller classes.
- I'd prefer to use a simpler controller class if that's the "best" way to do it, but at this point I'd also like to know what I'm doing wrong here. Maybe I need a formBackingObject method in MyResultController, but I couldn't figure out how to bind the model to the command object via the request parameters. Or even if that's what I'm supposed to do.
- I don't want my Result text to appear in the URL.
Grrr...
Help! Thank you!
--Glenn
P.S. The other parts of my setup are (I believe) pretty straightforward: