jQuery in Action, 3rd edition
The moose likes JSF and the fly likes Parameter from URL inside EL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Parameter from URL inside EL" Watch "Parameter from URL inside EL" New topic

Parameter from URL inside EL

Kristian Kaa

Joined: Nov 15, 2010
Posts: 2
First off, im very green at JSF, but im trying to get a hold of it, so forgive me if my question is stupid

Im trying to make an activation page with JSF, but i got a problem.
Can i parse a parameter from GET into a bean call?
I've tried different things like


but without any success. Is this even possible?

Thanks in advance!
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218
param is an implicit object, will #{param['key']} work? Just to be clear, use the
text "param", don't replace this with your parameter name. I tend to use these
things in system event listeners rather than in the page so can't speak from
experience. If this doesn't work I have a plan B, but that's got to wait for

Kristian Kaa

Joined: Nov 15, 2010
Posts: 2
If i have the url
and i use the #{param['key']}, it will print out 8, just like php's $_GET['key']

When you say you use "these things in system event listeners", do you mean you "get" the param all the way down from the java classes?
Not sure I understand what you mean, but thanks for your answer anyway :-)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

You don't "call" beans in JSF. JSF backing beans are made up of properties and/or action methods (along with the occasional listener or other lifecycle support method). The methods are invoked ("called") by JSF. JSF Views are display constructs, not logic constructs. Or at least that's what they're intended to be.

It's possible to pull in GET-method parameters inside a bean method by dereferencing objects from FacesContext. Not pretty, but often done, regardless. I think in JSF2 there's a simpler way. Or you can use PrettyFaces and have it inject the GET parameter in as a standard property.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Parameter from URL inside EL
It's not a secret anymore!