• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Can Servlet Call its self

 
CaptainYasser
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
CaptainYasser
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How Can I use include in this case ?
 
Kai Liu
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may try the directives.
<jsp:forward page='URL' | <%= expression %> flush="true" />
like this...
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic