This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSF and the fly likes Accessing backing bean. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Accessing backing bean." Watch "Accessing backing bean." New topic
Author

Accessing backing bean.

James Maddison
Greenhorn

Joined: Apr 12, 2007
Posts: 2
Hi everyone,

I'm a newbie with JSF so please bear with me. I would like to pass a HTTP header value to my backing bean but I'm not sure how to go about doing so. At present, the user's input is passed on to my backing bean in the standard form of

<h:inputText value="#{userBean.userName}" />

However, I would like userName to be assigned the value of a HTTP header, which is in the form of:

String headVal = request.getHeader("shib host");

So basically, I would like headVal to be passed on to my backing bean instead of the user's input. How would I do this? Any help in this matter would be greatly appreciated. Cheers.
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
Use the <f:param /> tag.


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
James Maddison
Greenhorn

Joined: Apr 12, 2007
Posts: 2
Hi Remko,

I tried what you suggested but I'm getting the following error:

javax.faces.FacesException: /login.jsp(49,3) According to TLD or attribute directive in tag file, attribute value does not accept any expressions

What I tried to do is:

<f:param
value="${headerVal}"
id="userBean"
name="userName" />

Am I doing it wrong? Thanks again for your help.
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
Did you use in your backing bean the following method for reading your variable

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing backing bean.