• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet and JSP interaction

 
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In which all ways a servlet can call a JSP page, and vice versa? I know one way. My interviewer said there are at least 4 ways (each) of doing this. Can someone elaborate the 4 ways?
Also, what sort of interview questions can I expect on Servlets/JSP?
TIA,
- Manish
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Calling a jsp from a servlet:
1:
HttpServletResponse.sendRedirect
2:
RequestDispatcher.forward
3:
RequestDispacther.include
4:
maybee more?
Calling a servlet from a jsp:
the 3 ways mentioned above(since a jsp gets translated to a servlet) plus
<jsp:include page="/myServlet">
<jsp:forward page="/myServlet">
<%@ include file="/myServlet" %>
Those are the ways I know, (I haven't tried out the code thought) Hope this helps
Dominic
 
Manish Hatwalne
Ranch Hand
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Dominic!
I has been quite some time since I used Servlets, I guess I need to refresh my knowledge ASAP..
- Manish
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Manish!
I have read it on the Sun site last night but I wasn't sure that was the answer so I was waiting for a post!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic