• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CommandButton doesn't call bean's method

 
Raphael Euclydes
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I'm having a problem regarding the use of bean's methods inside a jsf page. I have others classes and pages in this same way and they work fine, but this one doesn't. When I push "Iniciar Sessão" button it does nothing. There is no messages in the log nor it activates the breakpoints i put in the method.
The getters and setters work just fine, but the two bottom methods doesn't.

acompanhaTR.jsp



Sessao2.java



faces.config



Thanks guys.
 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this, I don't know the reason behind the solution but here is the solution



If you found out the reason behind setting immediate flag to true, please post it
 
Raphael Euclydes
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Davie Lin wrote:Try this, I don't know the reason behind the solution but here is the solution



If you found out the reason behind setting immediate flag to true, please post it


Davie, thanks a lot...I lost all day to this and the solution is so simple. =P
I'll check out the reason behind it and if i find i'll post it. Thanks.

-------------------EDIT---------------------
I'm having another problem now....I think it's because of the immediate flag.
I fill the fields "Sessão", "Tolerancia" and "Ambiente" of the jsp, which are the atributes sessao.nome, sessao.tolerancia and sessao.idAmbiente, but the values are not being transfered to the class. The insert of the method "inicia" is going null. Do you know how to fix it?
 
Davie Lin
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is your Sessao2.java the backing bean?

you got no JSF UI components. So how does that suppose to get the String value when you click the button?
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't tell for certain, but I think the real problem is that one or more inputs is failing to validate.

Put a <h:messages> element on the page and see if any interesting messages display.

If you have invalid fields, making a button "immediate" will cause the button's action method to be invoked, but "immediate" also means that no inputs will be processed. JSF will neither update the backing bean nor invoke the action processor if one or more inputs is invalid or if a required input is not supplied.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic