| Author |
Passing Parameters from Bean to JSP Page
|
Abiodun Adisa
Ranch Hand
Joined: Jan 17, 2002
Posts: 493
|
|
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: 1790
|
|
|
code looks OK. may be some other problem like you are making multiple requests.
|
Krishna Srinivasan
Java Writers Needed
|
 |
Abiodun Adisa
Ranch Hand
Joined: Jan 17, 2002
Posts: 493
|
|
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
|
 |
 |
|
|
subject: Passing Parameters from Bean to JSP Page
|
|
|