• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

servlet

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic