• Post Reply Bookmark Topic Watch Topic
  • New Topic

request dispatcher  RSS feed

 
kiran par par
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am coding in the following way
....

public void executeLogic(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
.....
...

try{
HttpServlet strutsServlet=(ActionServlet) request.getSession().getAttribute("ActionServlet");
ServletContext mainServletContext = strutsServlet.getServletContext();
....
...
LOG.debug("BEFORE dispatchMain ");
RequestDispatcher dispatchMain = mainServletContext.getRequestDispatcher(parameters);
dispatchMain.forward(request, response);

} catch (Exception e) {

e.printStackTrace();

}
protected void postProcess(
ActionMapping actionmapping,
ActionForm actionform,
HttpServletRequest httpservletrequest,
HttpServletResponse httpservletresponse) {

LOG.debug("in postprocess");
}

I am able to see the debug statement "BEFORE dispatchMain" and "in postprocess" but

dispatchMain.forward is not being executed ???

Any information would be very helpful guys. Thank you in advance.

.. kr
 
James Clinton
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly in the future please put any code inside code block.


Secondly, what is happening to make you think the request is not being forwarded.

Exceptions? Stack Traces? Logs?
 
kiran par par
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply james.



I was able to tell that request is not being forwarded becuase I do not see the debug statement in the servlet which I am forwarding to. I have debug statements at the very first which will tell me if the servlet is being is executedd or not. SO that is how I know it is not.
And weird part is there are no exceptions being thrown.
this whole behaviour is happening sometimes and sometimes everything is workign properly. Do you think is this something connected to configuration. But I should atleast see some exceptions.
 
kiran par par
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I found the problem. There was another exception(FmcException) that was being thrown before reaching the dispatcher code. That is the reason why it is not forwarding the request. But still I am not sure why that particular exception is not being printed when I am catching the generic "Exception" and printing the stacktrace. Anyway I think my problem is solved for now. I will update the post when I know it is definately is working.
thanks again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!