This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call servlet from JSF ?

 
Heba Fahmy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSF bean , and I want to call a servlet and send to that servlet paramter from the bean , how can I do that ?
any help ??!!
 
Abhinav Taduka
Greenhorn
Posts: 6
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can call servlet from FacesContext. In order to pass parameters to servlet you can use query params. Sample code for that will be as follows.


 
Heba Fahmy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem that I have a navigation , so when I did this approach I got the following exception
javax.servlet.ServletException: Cannot forward after response has been committed

so how can I provide a navigation role which is important to display the user message that the user's parameters were submitted .
and in the same time I can call the servlet ??

I tried to provide that by the servlet it self , but the response format of the servlet as xml and it must be that because the system logic requires that.

any help ??
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18014
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't ask the same question twice.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic