• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how provide navigation rule and call servlet

 
Heba Fahmy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 Jsf pages with navigation rule .

and in the bean I call servlet .

The parameters that the user enter are sent to the servlet which makes an xml format response (The system logic requires that ).
and with the navigation rule I can display to the user that his parameter has submitted.

The problem is :-
The navigation rule doesn't work with servlet calling in the bean ,
it throws the following exception
javax.servlet.ServletException: Cannot forward after response has been committed

so how can I display to the user that his parameter has been submitted ?



 
Tim Holloway
Saloon Keeper
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. Let's start by pinning down the terminology. Sometimes there's value in nit-picking.

You never "call" servlets, you make requests to them. Backing up even further, when a web app makes a request of another web app, that's really just a web services request.

You also seem to be saying that you want one user request to generate 2 separate outputs, in 2 different formats (content-types). HTTP doesn't do that. One request, one response. No more, no less. So you can either have the button, the XML or build an HTML page with a button on it that displays the XML as text, but you can't have the XML and the button as 2 separate output streams from the same request.

In any event, you shouldn't generate XML from JSF, just as you shouldn't generate any other non-HTML format data from JSF. I'm ignoring the fact that xhtml is both HTML and XML, since the "html" part is what counts. JSF generates html. To generate non-html XML, use a servlet, instead, just like I advised on a recent thread about generating Excel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic