Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call JSP page from a Servlet

 
swati bannore
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
I have a problem.I have a servelt say CheckLogin.java and a JSP file named EmployeeView.jsp.My servlet is validaing the username and password and based on those results I need to call my JSP file which displays the details of the employee.
How do I call a jsp file from this Servlet??
Can anybody help me??
Thankx
Swati
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swathi,
I use this practice and found useful. I wrote a method called gotoPage in a utility file called ServletUtilities.java and made it static. Whenever I want to route the response to some resource I just call ServletUtilities.gotoPage(....); One more advantage is in goToPage method I use encodeURL. So if I want to encode/de-encode all the routed urls, just change in only one method gotoPage and it is reflected in WHOLE web appln. Also note that the url which we give to gotoPage(...) is relative web url with respect to the web appln.
regds
maha anna

[This message has been edited by maha anna (edited October 18, 2000).]
 
swati bannore
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanxx Maha,it did work and
even response.sendRedirect(EmployeeView.jsp) works fine!
Swati
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic