aspose file tools*
The moose likes Servlets and the fly likes How Can Servlet Call its self Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How Can Servlet Call its self" Watch "How Can Servlet Call its self" New topic
Author

How Can Servlet Call its self

CaptainYasser
Greenhorn

Joined: May 29, 2002
Posts: 2
I use MVC model with one Servlet and Many Handlers
, The Servlet forward to the specified handler which perform some business logic then forward to the JSP :
getServletContext().getRequestDispatcher( JSP_NAME ).forward( p_Request, p_Response );
Now I need to forward first to another handler(The same servlet) to perform some business and then forward to JSP , How can I do that ?


Officer - African Armed Forces
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Instead of forwarding, can you just use include? In this case you will still be within your main servlet, but you will be including the functionality of another servlet.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
CaptainYasser
Greenhorn

Joined: May 29, 2002
Posts: 2
How Can I use include in this case ?
Kai Liu
Greenhorn

Joined: May 29, 2002
Posts: 9
You may try the directives.
<jsp:forward page='URL' | <%= expression %> flush="true" />
like this...
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
CaptainYasser and tofranklu
Welcome to the JavaRanch! Please adjust your displayed name to meet
the <BR>JavaRanch
Naming Policy
. <BR>You can change it here.<BR><BR>Thanks!
and welcome to the JavaRanch!
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
If it's not a silly question, why do you think you need to "forward" to the same same servlet at all? Why not just call a method to do your "business"?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
 
subject: How Can Servlet Call its self