GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Query on Request Dispatcher. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Query on Request Dispatcher." Watch "Query on Request Dispatcher." New topic
Author

Query on Request Dispatcher.

Viji Elango
Ranch Hand

Joined: Apr 25, 2006
Posts: 36
In my filter code, I'm checking whether it is downtime, and if it is the case, then I'm dispatching to another JSP.
But I'm facing problems here.

1. Can I use RequestDispatcher in my Filter code?
2. Is the Usage that I've followed is correct?

Niranjan Deshpande
Ranch Hand

Joined: Oct 16, 2005
Posts: 1277
it seems fine
just hit tomcat and run your app


SCJP 1.4 - 95% [ My Story ] - SCWCD 1.4 - 91% [ My Story ]
Performance is a compulsion, not a option, if my existence is to be justified.
Viji Elango
Ranch Hand

Joined: Apr 25, 2006
Posts: 36
I'm getting error.
javax.servlet.ServletException
at weblogic.servlet.internal.RequestDispatcherImpl.forward(Ljavax.servle
t.ServletRequest;Ljavax.servlet.ServletResponse V(RequestDispatcherImpl.java:33
4)
at com.sgr.gss.web.filter.MaintenanceWindowFilter.doFilter(Ljavax.ser
vlet.ServletRequest;Ljavax.servlet.ServletResponse;Ljavax.servlet.FilterChain V
(MaintenanceWindowFilter.java:109)

Can't understand where I'm wrong.
Viji Elango
Ranch Hand

Joined: Apr 25, 2006
Posts: 36
I'm getting the error, response already committed..

Any help please..
Bachi Taurean
Greenhorn

Joined: Aug 03, 2006
Posts: 26
Hi viji,

You cant call filterChain.doFilter after you have done a forward, since by the time you call doFilter, the request and response objects are already in control of another web component.


Success is never ending and Failure is neve Final
Viji Elango
Ranch Hand

Joined: Apr 25, 2006
Posts: 36
Thanks for your reply..
I tried using SendRedirect.. But this time, my loop is running infinite..
Please help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Query on Request Dispatcher.