• 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

Calling Html file from a servlet

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
In my application i have many html files, The welcome html file displays the username and password. On entering the
Username and password the user is given access to the second html file where the user can use the application eg searching
file...I have dont the welcome html page and i've written the Servlet and deployed it in the J2EE 1.3.1, Suns Application server.

I'm printing a messge "Invaild username and password" in case if the username and password do not match aganist the one in the database.
On the otherhands i should display another HTMl file if the username and password is valid..

can anyone tell how to call the second html file, ie on clicking the submit button the next page should be displayed..

can anyone tell me how to do this..
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Swami..

you need to use RequestDispatcher for this pupose..

e.g.
RequestDispatcher rd=request.getRequestDispatcher("/applicationname/xyz.html");
rd.forward(request,response);


Take Care..
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Swaminathan Balasubramani:

can anyone tell how to call the second html file, ie on clicking the submit button the next page should be displayed..
can anyone tell me how to do this..



Swaminathan,
If you're not sure how HTML forms submit, I would take a little time away from this project to follow some tutorials, both on Servlets and on HTML.
There is an excellent chapter on HTML Forms (chapter 16) in Core Servlets and Java Server Pages. This book can be downloaded for free at http://pdf.coreservlets.com
The time you spend getting this under your belt will more than pay off in the long run. Both in time and frustration saved.

Good-Luck
-Ben
 
Swaminathan Balasubramani
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ben,

Thank u so much..
 
reply
    Bookmark Topic Watch Topic
  • New Topic