Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Session variable question  RSS feed

 
Martin Fei
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am very new to JSF and I am trying to find my feet by experimenting. I recently tried to define session variables which I could reference in my jsp's to do common things like display the title of a page.

My problem is cannot figure out how to change the value of such a session variable from the constructor of one the backing beans of a faces jsp.

In my faces config I have the following:

<managed-bean>
<managed-bean-name>pc_Globals</managed-bean-name>
<managed-bean-class>pagecode.Globals</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>title</property-name>
<value>WesBank Intranet: Home</value>
</managed-property>
<managed-property>
<property-name>leftHead</property-name>
<value>Home</value>
</managed-property>
</managed-bean>

And I want to change 'leftHead' to something else depending on the page being browsed.

Could anyone please give me a clue as to how to do this and also if you have any suggestions on what might be a better approach to achieve the same thing that will even be more appreciated.

Thanks alot
newbie
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you are using ibm-jsf.jar, make use the prerenderer attribute of <hx:scriptCollector> and set the session in the onPageLoadBegin method of backing bean.

Thanks,
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!