in my webapp i have a condition that on button click the data in a textbox should be assigned with the user name and should be posted to database, and it should be redirected back, here i'm unable to have the value in textbox, but if i click the back button it is there. please help me with this.
Below are the screens showing it
in the third screen i'm getting it if i hit a back button and if i hit redirect to home it will trigger a query that is on that page. i want to go to previous page automatically. please help me with it.
i want something that acts like a browsers back button
1. you are entering say "xyz" in text box - which has name = "userInput"
2. now you are submitting to servlet(for example), there you are getting value as
String txtBoxVal = request.getParameter("userInput"); then you are inserting txtBoxVal to DB right?
3. then, if you forward again to first/form jsp = >
then set the txtBoxVal to request attribute in servlet
or, if you redirect then place the value as querystring.
4. now you get the value from appropriate place(param or attribute), then show as a value of the textbox
as in value='${param.txtBoxVal }' or value='${"txtBoxVal"}'
Rakesh Keerthi
Ranch Hand
Joined: Jul 16, 2012
Posts: 103
posted
0
no here actually the textbox value is getting pulled from the database, and once the button is clicked the the alloc column should be added with the logged in user name for the corresponding row(textbox value) in the database i.e. here post operation is being done and in the home page there is a query to fetch the data with user name as null into the textbox. so, when i click the button the post should be done and the text in textbox should be the previous text. only when user clicks in the link 'home', new data is to be fetched from the database.