File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Html file from a servlet

 
Swaminathan Balasubramani
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • 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..
 
Kutub Shaikh
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • 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..
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ben,

Thank u so much..
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic