aspose file tools*
The moose likes Servlets and the fly likes Help regarding a link to a page from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help regarding a link to a page from servlet" Watch "Help regarding a link to a page from servlet" New topic
Author

Help regarding a link to a page from servlet

nash avin
Ranch Hand

Joined: Nov 13, 2003
Posts: 96
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

Joined: Mar 22, 2000
Posts: 12823
    
    5
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

Joined: Nov 13, 2003
Posts: 96
Hi,
Thanks for the information.I will try what you have adviced.Will keep posting.
As
 
 
subject: Help regarding a link to a page from servlet