File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes how provide navigation rule and call servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "how provide navigation rule and call servlet" Watch "how provide navigation rule and call servlet" New topic
Author

how provide navigation rule and call servlet

Heba Fahmy
Greenhorn

Joined: Feb 03, 2012
Posts: 4
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

Joined: Jun 25, 2001
Posts: 12513

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.


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
 
 
subject: how provide navigation rule and call servlet
 
Threads others viewed
Clear the value of parameter 'javax.faces.ViewState'
Newbie question on RELOAD or REDIRECT?
how to use managed bean property in navigation rule tag of faces config.
Access managed bean from a servlet
success alert using javascript
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture