aspose file tools*
The moose likes JSF and the fly likes Using f:setPropertyActionListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Using f:setPropertyActionListener" Watch "Using f:setPropertyActionListener" New topic
Author

Using f:setPropertyActionListener

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,

I am trying to pass two parameters i.e. (nomComposantARejouer, typeFileARejouer) to an action method (gestionnaireMessagesController.rejouerMessage) using the setPropertyActionListener (we use jsf 1.2).

Here is the relevant jsp code:

However, I always get a NPE because both parameters are null when used in the action method:



FYI, the variables and can be displayed without problem and are not null.

Also ignore the h:columnHeaderFacet tags. They are inhouse tags that I've renamed.

I am not sure what I am getting wrong. Can anyone please help?

Regards,
Yeray Santana Borges
Ranch Hand

Joined: Mar 02, 2008
Posts: 46
I think that your code is doing something wrong in the getter and setter of nomComposant and typeFile. Could you write them?, what is the scope of your bean and how are you initializing the nomComposant and typeFile variables?

In my opinion you should remove the setPropertyActionListener, I think that you don't need them.
When you are clicking on commandLink "rejouer", first you are getting the value of nomComposant to assign it to nomComposantARejouer (getters and setter will be called before your code enter in rejouerMessage() method), maybe you can use directly the value of nomComposant in your backed bean when you are in rejouerMessage(), something like this:




SCJP 6 - SCWCD 5 - SCBCD 5
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Thank you for your reply Yeray.
I finally went on to use f:param which works well in my case.
J.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using f:setPropertyActionListener