This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF EL conditional statement returning a jsf el syntax problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSF
Reply Bookmark "JSF EL conditional statement returning a jsf el syntax problem" Watch "JSF EL conditional statement returning a jsf el syntax problem" New topic
Author

JSF EL conditional statement returning a jsf el syntax problem

Jeff Pace
Greenhorn

Joined: Sep 04, 2009
Posts: 2
I am trying to use jsf el to to a conditional statement in my faces-config.xml file.

<key>#{ (currentUserRole.userInSecureRole==true) ? agsws3 : agsws0}</key>

works perfectly

the problem is the next line needs to be

<value>#{ (currentUserRole.userInSecureRole==true) ? #{agsws3} : #{agsws0}}</value>

which of course doesnt parse

basically if it fails check it needs to be

<key>agsws0</key>
<value>#{agsws0}</value>

and if it passes

<key>agsws3</key>
<value>#{agsws3}</value>

please help! thank you.
Babu Subburathinam
Greenhorn

Joined: Sep 03, 2009
Posts: 7
When you use #{agsws0} it is going to start looking for a <key>agsws0</key>. Which is in the process of getting defined. So there is a cyclical dependency.

So what is the value of #{agsws0}?
Jeff Pace
Greenhorn

Joined: Sep 04, 2009
Posts: 2
#{agsws0} is another managed bean

basically i have a resource bean

that bean has properties that are a list of other beans

so

<value>#{agsws0}</value>
<value>#{agsws1}</value>
<value>#{agsws2}</value>

etc.

the <key>agsws0</key> is just the name of the value, so no cyclical dependency.

My problem is i need the jsf el conditional statement to return a reference to a bean #{agsws0} and not a string

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JSF EL conditional statement returning a jsf el syntax problem
 
Similar Threads
Assignment Q
Switch
when return is required
Detecting Errors in jsf
why doesn't it compile? while(true) vs if(true)