Most JSPs require some sort of preparation before they can be displayed such as populating lists for dropdown boxes, getting user information from a database, etc. If the JSP contains an HTML form as most do, there is also an action that must be taken when the form is submitted. Hence, there is often a need for two actions for every JSP: One to prepare for the display of the JSP, and one to process the information entered by the user in an HTML form.
Originally posted by Merrill Higginson: Most JSPs require some sort of preparation before they can be displayed such as populating lists for dropdown boxes, getting user information from a database, etc. If the JSP contains an HTML form as most do, there is also an action that must be taken when the form is submitted. Hence, there is often a need for two actions for every JSP: One to prepare for the display of the JSP, and one to process the information entered by the user in an HTML form.
after running this code implementing the back and next buttons.
when i use back button from the last jsp to privious jsp, the value I select from the list is not appearing.
May i know what should i do to solve this problem.
and the big question is if I have more than one list box which should always show the selected iteams whn i come back from the other pages i think this code has to be modified.
Bear in mind that this code was written as a simple demo, not a complete application. It has no database persistence, which is something you'd naturally want to put in an actual application.
In order to have the value selected retained, you would have to actually save the value to a database and then retrieve it when the page is redisplayed. In the example, you would add the following lines to the PrepareColorAction class:
You'd then add the following code to the ProcessColorAction class:
thank you very much Mr. Merrill Higginson for your indetailed reply.
And it seems we are supposed to create an onther class which gets and sets color. I think, even though UserDao is not a form bean it resembels like it.
Thnks and regards, rahul
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
Gift giving made easy with the permaculture playing cards