wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 15950

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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: XHTML file throws illegalstate exception
Similar Threads
Padding for Numeric values
write output to an xml file
JSF problem
Need help in xhtml files
Error after navigation