Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have three pages of static html and the last page has
submit button. I want to put all the data into database when
i hit the button. This part I can do using servlets, but i want to know how to get data from the previous html page.
It is a online form with three html pages.each html page leading to the other.
If u have any idea of how to go about please help me.

bye
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The standard way to do this is to link the pages via a servlet, rather than just a raw hyperlink. For example:
Page 1:

Page 2:

When the servlet receives a POST request it checks the value of the "action" parameter. If it is "Go To Page 2" then it saves the first page of information in a temporary place (in the current session for example), then displays the second page. If "action" is "Finish", it retrieves both the stored temporary data from page 1 and the parameters from page 2 and processes them together.
I've used this technique for both sequential multi-page forms and more complex "tabbed" pages where the user can select them in any order.
 
S Varana
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for ur suggestion
I am using anchors to navigate. I have to use them .
Now can i place a hidden button which gets invoked without user's knowledge and which does the storing of temporarry data thru servlets.
Any ideas of how to go about like how will my hidden button get focus automatically etc etc.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need a "hidden button", just some JavaScript. Any link can have an associated "onClick" handler, so just put a little code to submit the form in it. For example:

I'm puzzled as to why you "have to use" an anchor. Can you clarify this? Are there other important restrictions?
 
S Varana
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried ur code but gives me error saying object
does'nt support this property or method.
What is the problem?
Thanx for ur reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic