File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes CommandButton doesn't call bean's method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "CommandButton doesn Watch "CommandButton doesn New topic
Author

CommandButton doesn't call bean's method

Raphael Euclydes
Greenhorn

Joined: May 02, 2010
Posts: 3
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

Joined: Aug 05, 2007
Posts: 294
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

Joined: May 02, 2010
Posts: 3
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

Joined: Aug 05, 2007
Posts: 294
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

Joined: Jun 25, 2001
Posts: 16250
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CommandButton doesn't call bean's method