Two Laptop Bag*
The moose likes Servlets and the fly likes Servlet and JSP interaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet and JSP interaction" Watch "Servlet and JSP interaction" New topic
Author

Servlet and JSP interaction

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

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
Dominic Paquette
Ranch Hand

Joined: Dec 13, 2002
Posts: 64
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

Joined: Sep 22, 2001
Posts: 2578

Thanks Dominic!
I has been quite some time since I used Servlets, I guess I need to refresh my knowledge ASAP..
- Manish
chad stevens
Ranch Hand

Joined: Aug 20, 2002
Posts: 88
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet and JSP interaction
 
Similar Threads
Debugging in java j2ee
Servlet Alias
Servlet & JSP interaction; and interview questions
forwarding within the application
Servlets interview questions . . .