Persisting input fields
Posted on 2005-04-17
I'm looking for some assistance in modifying an existing jsp page to add some new persistent input fields. Just understanding what is going on under the hood is a bit of a challenge.
First the observed user experience with what I've done so far. My input form comes up with some fields. I have added my new fields to the form, if and only if certain conditions are true based on a database query on a id passed into this form - call this form "info1". Info1 has some functionality that you choose items displayed on it by moving to another page (call it select1), selecting one of many items, then you return to info1. Problem is - my new fields get blown away after this workflow. When the user is returned to info1 after selecting a new item any data they have entered is missing. The question becomes - how do I get my new input fields to survive the detour into the select1 page?
A few more relevant technical details, so far as I have discovered the so far:
session is disabled for the page by an @include in info1
The database query that determines whether my new fields are displayed is performed in a @included jsp (call it Include1). Currently I'm setting a boolean variable in this jsp, if my fields should be displayed. Existing fields on info1 are either pulled from the database (initial case) or by using "request.getParameter" (after select1).
The form element in info1 posts to a intermediate processing jsp, which then redirects using jsp:forward to select1
select1 posts back to info1 (I think) with the item selected.
info1 grabs existing field data using request.getParameter, my new fields are nowhere to be seen...
An existing input field that works (its data survives the select process) on info1 looks like this in the jsp:
<INPUT type=text name="shippingInstr"> <%=shippingInstr%> </INPUT>
shippingInstr is set in Include1, using a database query in the initial case and a getParameter call after the select.
So given this workflow - display info1, post to intermediate, redirect to select1, post to info1. How do I ensure that data entered into my new input fields on info1 is repopulated when the user returns from the select1 page?