This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

saving the details in when i click next and previous buttons  RSS feed

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

in my application i have one scenario like this

i will create 3 rows like this

eno ename sal
textbox textbox textbox
textbox textbox textbox
textbox textbox textbox

Next



eno ename sal
textbox textbox textbox
textbox textbox textbox
textbox textbox textbox

Previous

i will enter details in textboxes and then i will click next button
i will call same page again this time i will enter details in 3 rows again like i did previously this time i will put Previous button when i click previous button The details be populated in the first that i have entered in the first page and when i click next button the details should be displayed that i have entered in the second page;

How can i do this any idea??
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Name your textboxes in a fashion that they do not over-write when the pages change.
Prefix the page number to the fields, so on submit, u can submit the form & the bean can save it in some data structure & store it in session with the key as the page number.

when u get back to the page, try to see if the session has the value for a given page number, if yes, get the values & populate the text fields, if not, show them blank

doesnt seem too complicated for me

 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi balram

can u elaborate bit more i didnt understand completely;
 
Balan Raj
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Donno which part was unclear, I'll try to restate what I said,probably with more clarity


Name your textboxes in a fashion that they do not over-write when the pages change. Prefix the page number to the fields, so on submit, u can submit the form & the bean can save it in some data structure & store it in session with the key as the page number.



In your JSP, make sure the text boxes are not having harcoded names.
They would look something like :


When you submit the form,
in your bean you will iterate throught the request & collect the matrix of the form data into some kind of 2 dimensional array.

String pageNumber = request.getParameter("pageNumber");
String rows= request.getParameter("rows");
String cols= request.getParameter("cols");

//NOTE : convert row & col to integers
iterate rows :
iterate cols :
formData[rowItr][colItr] = request.getParameter("mytextbox+<%=row+col+"_"+pageNumber%>");

So u loop thru & get all the form elements into the 2d array.

Now put that into session, with a simple
session.putValue("myFormDataForPage"+pageNumber, formData);

Now, comes the intersting part of setting the values..
your form will post to itself, with the correct pageNumber incremented or decremented.
So, I will rewrite my input box with something like



Well, hope this helps
 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u for ur reply
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!