File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes XHTML file throws illegalstate exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "XHTML file throws illegalstate exception" Watch "XHTML file throws illegalstate exception" New topic

XHTML file throws illegalstate exception

Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272


I have just started to learn JSF using JSF Complete reference. I created a XHTML and tried to run it on server. Instead of browser displaying the contents of the XHTML, it downloads the XHTML file.

I get a IllegalStateException stating "Cannot create a session after the response has been committed".

Please let me know what I am missing here. Also let me know if there is any other better book to refer for JSF.


Ashwin Sridhar
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Any Suggestions..
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16883

Ashwin Sridhar wrote:Any Suggestions..

I can almost guarantee that you are attempting to seize the HttpServletResponse stream from JSF and add your own headers and/or content. You should never do that.

If you are attempting to generate non-HTML response such as a PDF or a Microsoft Office document, use a servlet or (non-JSF) JSP to do that.

Customer surveys are for companies who didn't pay proper attention to begin with.
Consider Paul's rocket mass heater.
subject: XHTML file throws illegalstate exception
It's not a secret anymore!