• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the JSF way to reference a hash?  RSS feed

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Not sure if this falls in the realm of JSF, but I have a question. I want to reference the hash value (if any) of my URL and print a result based on what it is. So if my url ends with "#myHash", I want to output a certain thing, and if it is anything else, or no hash at all, I want to output "0". What would I need to replace the value of the "selectedChild" attribute below with to achieve this?

<div dojoType="dijit.layout.TabContainer" id="tabs" jsId="tabs" layoutAlign="client" selectedChild='<!-- if hash == "myHash" print "1" else print "0" -->'>

Thanks, - Dave
 
Tim Holloway
Bartender
Posts: 18715
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't recommend putting logic in the view. It's usually cleaner and less frustrating to just define the results of the expression in a backing bean property getter.

However, the answer to this, and many similar questions has to do with the Java Expression Language (EL). Original there were several variants of EL, depending on the platform, but they've been combined to produce a unified expression language.

In the open-source Jakarta realm including Struts and MyFaces, the BeanUtils library handles EL needs. You can find more about it at http://commons.apache.org .
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!