Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using f:setPropertyActionListener

 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:


 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply Yeray.
I finally went on to use f:param which works well in my case.
J.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic