File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display HTML page from a servlet

 
David McWilliams
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have written a simple servlet that I want to invoke from a web page. Basically, I want to be able to load my initial webpge, enter an email address and click submit. I want this page to pass the email address to my servlet, I want the servlet to return a list of customers associated with that email address and post them to a webpage.

Do any of you know of any tutorials I could follow to achieve this?

Most of the tutorials I have seen dynamically create the display HTML webpage, e.g.

out.print("<html><head>");

I don't want to do this. I want to creat my own webpage in my own style and have the serlvelt populate it with customer data, not dynamically create the page.

I have tried the following from my doGet() method but it doesn't work. The dispatcher is created but the html file doesn't load.





Any help is welcome,
David
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The request dispatcher is a good start. but the keyword here is JSP. Google for a tutorial you'll find plenty.
 
Rajkishore Pujari
Ranch Hand
Posts: 46
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch..
 
David McWilliams
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shanky Sohar wrote:Welcome to JavaRanch..


Many thanks..
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and one more thing with forward, you can forward your request to any resource like jsp,servlet,HTML




but remember Forward should be called before any request should be commited to the client.otherwise you will get illegalArgumentException..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic