Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help regarding a link to a page from servlet

 
nash avin
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I want to direct to another page if a user is not present in the database.How do I go about doing this.The servlet gets the username and password from the html/jsp page.
The servlet checks whether the use is present in the database,if the user and password is not present in the database,The user must be given an option for registration,a link to the register.jsp page.
Hope that I have rightly phrased the question.Hoping to hear ASAP.
Thanks in advance.
as
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand you correctly, what you want is the sendRedirect capability of the HttpServletResponse object. You should decide to redirect before writing any output to the response and should do a return from the servlet without trying to do anything else with the response.
An alternative would be to use the RequestDispatcher forward method.
Bill
 
nash avin
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for the information.I will try what you have adviced.Will keep posting.
As
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic