Two Laptop Bag
The moose likes JSF and the fly likes Faces servlet exception with forwarding Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Faces servlet exception with forwarding" Watch "Faces servlet exception with forwarding" New topic
Author

Faces servlet exception with forwarding

henri delbrouck
Greenhorn

Joined: Jul 12, 2004
Posts: 7
With MyFaces 1.0.9 and Tomcat 5.0.28, I have activated a filter.

Within this filter, I call a method which check if the user has already been authenticated. If he is not authenticated, there is a forward to an external system for authentication (CAS system).

Withe the faces servlet, I receive the following error:
"cannot not forward after response has already been committed".

This does not happen with normal JSP pages. The forwarding occurs successfully.

Could anybody help me what is wrong and what is the solution to avoid this problem.

Thank you in advance

Henri-Philippe Delbrouck
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
How does the code in your filter look like?


- Varun
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15229

Usually, you'll get this message when you have tried to forward the request somewhere more than once in a servlet. So if you had something like:



What you will want to do is set whatever parameters you need in the if/else and then foward only once.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: Faces servlet exception with forwarding
 
Similar Threads
Odd problem with RichFaces and Servlet Filter
Problem while forwarding
Dynamically changing url mapping for a servlet/jsp? Can I use filters?
RequestDispatcher
richfaces and problems with navigation