1

I'm out of ideas for my exception handling...

Using:

    <myfaces.version>2.0.11</myfaces.version>
    <richfaces.version>4.1.0.Final</richfaces.version>
    <tomahawk.version>1.1.11</tomahawk.version>
    <weld.version>1.1.4.Final</weld.version>
    <codi.version>1.0.3</codi.version>

i plugged a simple exception handler that navigates to an error page.

Now an error raises in the render phase when accessing a bean value - it seems i can't change the navigation anymore (buffer already written?). The browser simply displays the partially rendered page. The state on the server seems to be corrupt from now as further requests contain the link to the old window scope - i always run in the same error.

How to handle such a case? Specification problem, MyFaces problem or developer problem?

mtraut
  • 4,720
  • 3
  • 24
  • 33

1 Answers1

1

How to handle such a case? Specification problem, MyFaces problem or developer problem?

Developer problem. Don't do business logic inside a getter method. Do it in (post)constructor or (action)listener method instead.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Well, even if i don't like this specific response selection of yours, for me you're the last instance in JSF questions... Many thanks again. I hoped you'd be online :-) – mtraut Jan 19 '12 at 14:46
  • 1
    A committed response is a point of no return. This is regardless of the web language/framework used. A nasty workaround would be to set the default response buffer size to something large. It defaults in most environments to 2KB. You could set it to 100KB or whatever size your largest page is (and ensure that server has enough heap). In JSF2, you can set it by a `javax.faces.FACELETS_BUFFER_SIZE` context param. But still, doing exception-sensitive business logic in a getter is a bad idea. See also http://stackoverflow.com/questions/2090033/why-jsf-calls-getters-multiple-times/2090062#2090062 – BalusC Jan 19 '12 at 14:50
  • thx again for the parameter. Problem is, we are migrating an application from another framework and are not eager to change lifecycle or busines logic. – mtraut Jan 19 '12 at 14:55