Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Display HTML page from a servlet

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://download.oracle.com/javaee/5/tutorial/doc/bnagx.html

 
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch..
 
David McWilliams
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shanky Sohar wrote:Welcome to JavaRanch..



Many thanks..
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Evil is afoot. But this tiny ad is just an ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic