File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Problem passing params using managed-propertys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Problem passing params using managed-propertys" Watch "Problem passing params using managed-propertys" New topic

Problem passing params using managed-propertys

Dave Brown
Ranch Hand

Joined: Mar 08, 2005
Posts: 301
Hi all,

Having trouble today trying to utilise JSF's param's & injectors features. But without any success.

What I have is a button on Page1 which has a f:param that I want to be automatically injected into Page2. However the injection never takes place.. the value passed always appears to be null.

So on Page1 I have the following..

The action above relates to the following navigation rule...

The managed bean definition with the managed property for Page 2 is..

So from what I've read online.. the f:param should be automatically injected into the Page2 bean.. However as said, I put a little debugging in the setter of my source field and when thats called, the source is always null.

Any thoughts/advice appreciated.. I really want to understand this method of passing data rather than having to stick things in the session bean all the time..


Regards, Dave Brown
SCJP 6 - [url][/url] - Check out Grails Forum
Kavita Tipnis
Ranch Hand

Joined: Sep 21, 2008
Posts: 177
This will help you understand better
Communications in JSF
Dave Brown
Ranch Hand

Joined: Mar 08, 2005
Posts: 301
Kavita Tipnis wrote:This will help you understand better
Communications in JSF

Thanks for that link, I've bookmarked it, its a good article.

Unless I'm missing something though, my approach should be working.. I'll give the alternative method of using hidden form elements a go rather than the f:param...
Dave Brown
Ranch Hand

Joined: Mar 08, 2005
Posts: 301
After playing around a little I've discovered something which I'm not sure is standard behaviour of JSF or not.. hopefully you might be able to shed some light..

My parameter is passed perfectly when I used a <input type="hidden"> tag AND ONLY if I specify the action directly on the command button definition.. E.G..

However, if I want to perform a little extra processing when the button is clicked and specify a backing bean method as the action, the parameter does not get through to Page2..

I.E this doesn't work..:

I can only assume whats happening is the parameter is getting through to the call to the backing bean method.. But not forwarded on to Page2 after that...

Shouldn't that be the case ?

I agree. Here's the link:
subject: Problem passing params using managed-propertys
jQuery in Action, 3rd edition