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 Passing Parameters from Bean to JSP Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Passing Parameters from Bean to JSP Page" Watch "Passing Parameters from Bean to JSP Page" New topic
Author

Passing Parameters from Bean to JSP Page

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
I am trying to put a String inside of a request object which is contained in my Managed bean. So that I can retrieve it in my JSP using the
request object, but its kind of failing

This is the code in my Managed Bean


getFacesContext().getExternalContext().getRequestMap().put("display","Hello");


and in my JSp i have

String tempString=(String)request.getAttribute("display");


Any suggestion would be welcome
Praful Sinha
Greenhorn

Joined: Jan 25, 2008
Posts: 18
Hi Adisa,

Hi
Istead of getRequestMap method please use getRequest.
Which will give you request object of your Http protocall.

Please use this code and try to fetch your string value in jsp.

HttpServletRequest req=(HttpServletRequest)getFacesContext().getExternalContext().getRequest();
req.setAttribute("display","Hello");



and in my JSp use
String tempString=(String)request.getAttribute("display");

Thanks and Regards,
Praful Sinha
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

code looks OK. may be some other problem like you are making multiple requests.


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
Originally posted by Praful Sinha:
Hi Adisa,

Hi
Istead of getRequestMap method please use getRequest.
Which will give you request object of your Http protocall.

Please use this code and try to fetch your string value in jsp.

HttpServletRequest req=(HttpServletRequest)getFacesContext().getExternalContext().getRequest();
req.setAttribute("display","Hello");



and in my JSp use
String tempString=(String)request.getAttribute("display");

Thanks and Regards,
Praful Sinha


Thanks for the reply it worked
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing Parameters from Bean to JSP Page
 
Similar Threads
How do I set this managed bean property?
Providing anchor to columns in a datatable
JSF validator problem
what methods do managed bean and backing bean contain
jsf problem go from jsp page to another jsp in new window