File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet and JSP interaction" Watch "Servlet and JSP interaction" New topic

Servlet and JSP interaction

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

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

Joined: Dec 13, 2002
Posts: 64
Calling a jsp from a servlet:
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
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

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:
subject: Servlet and JSP interaction
It's not a secret anymore!