File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing backing bean.

 
James Maddison
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 893
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the <f:param /> tag.
 
James Maddison
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 893
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic