I have been looking for on Google and other forums information about this error, but nothing solution works with my application.
In my JSF Tool, I effort an java.lang.NumberFormatException. When this error is catched, the flow goes to my SecurityFilter class and in the doFilter method I declare a sendRedirect method. But when this is executed I'm only obtain *"java.lang.IllegalStateException: Cannot forward after response has been committed"*
The error is launched when the application is trying lo load a table into a form.
You'll have to do things differently as the way you've chosen now simply does not work. You can't generate a response (meaning data is already sent to the client / browser) and then half-way through decide that you want to do something else - HTTP does not work that way. One request, one response. So if you really must redirect to an error page you had better make sure that you can do that before you decide to start dumping data to the client.
Note that your description is a bit vague, so it may just be that I misunderstand the order of things as they are happening.
Handling errors in the response-rendering phase is a bit tricky. Wonder if cacheing the reponse (either by configuration or by writing to a bytebuffer or something) until you're sure everything is OK could work?
Yes - redesign you code such that the getElements() no longer throws an exception. You could try by creating a @PostConstruct annotated method in which you initialize the elements up front and deal with exceptions there, but don't delay it until the moment where the page is already rendering.