Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Directing to an HTML file.  RSS feed

 
Paul Wright
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ive created a series of servlets of which when the user logs on they get directed to different pages.

My question is how do you make an HTML page come up after the servlet has run.
I know how to do it by generating the code inside the servlet with output.print(); but I just want it to say:
If (condition)
Then (go to this page)
Else (go to this page)

Is this possible or do i have to generate each page inside the servlet?
 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,
I think you can use method sendRedirct(String url) in HttpServletResponse.
Or you can use method getRequestDispatcher(String path) in ServletContext and after that you use method forward(HttpServletRequest req, HttpServletResponse res).

Hope this helps...
Correct me if I am wrong

daniel
 
Paul Wright
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for that. I used the sendDirect(String url) method.

Was just what i was after.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!