Wednesday 15 February 2012

jsf - Bean method reading null property from xhtml -


I have read many posts in StaxHourFlow but I have not been able to implement the problem below.

The problem is: let me & lt; P: inputTextarea> There is a need to type some text in and clicking on the button I need to get this value in the bean method.

Ie:

  & lt; P: inputctactor binding = "# {input}" /> & lt; P: command button action = "# {pessoaMB.adicionarContato (input.value)}" instant = "true" /> With Bean Method   

:

  Public Zero Additional Contatata (string value) {System.out.println (value); }   

The code I am using gives me a null value.

I am using visual visibility @ and can not change it. First of all, note one side: It's a bad practice to work with JSF components, you should work with models instead that means Do not use binding = "# {input}" , but paste it on value = "# {bean.txt}" .

Secondly, I suspect that instant = "true" is used properly in your setup. When UICommand components like & lt; H: commandButton & gt; for the skip component, the JSF life cycle immediately = "incorrect" (or omitted, as it is default) , Thus their value will not be set at all. However, JSF still determines the welcome submitted behind the prescription before the action method is executed.

Also, I recommend reading Balus's blog post, because this topic.

As a solution, I suggest to deal with beans with price bond, as shown in the first comment. With this approach you will not need Action Method parameter. Also, reuse your immediate attribute if you think this is correct, then you have two options: (1) instant = "true" on And

inputtactire> gt; or (2) code> action = "# {Bean. Action (input submittedValue)}" .

No comments:

Post a Comment