3

The input field boxes are filled with #{ad.userid} like that in all pages. And even though when I enter valid values they are giving null values in managed bean when accessed in action method. How can this happen and how can I solve this?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
john
  • 97
  • 1
  • 3
  • 10
  • please take your time to give the necessary details and structure your question in a more readable way. – Bozho Jul 14 '10 at 15:55
  • Hint: Do not assume the same people that answered your previous question will also see this one. ;-) – Tomalak Jul 14 '10 at 15:56

4 Answers4

2

This can be caused by unnecessarily having immediate="true" in h:commandButton, or by using rendered, disabled or readonly attributes in the input fields (or one of its parent components) which are depending on a request scoped bean which isn't properly retained in the subsequent request. There are more possible causes, but that's too much to be mentioned. The aforementioned are at least the most common causes among starters.

To learn more about the JSF lifecycle so that you can get a better understanding of what's all happening "under the hoods" so that you can nail it better down yourself, check this article: Debug JSF lifecycle

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Indeed, I used "disabled" and the orchestration between a former on blur ajax event and a latter onclick commandbutton event didn't work appropriately. I got rid of disabled and it worked as usual (described here: http://stackoverflow.com/questions/40596558/primefaces-6-0-inputtext-ajax-event-commandbutton-event-yields-null-bean-fie). – Mohamed Ennahdi El Idrissi Nov 15 '16 at 01:18
2

I had same issue. In my case I had these imports in place in my bean:

import javax.faces.bean.RequestScoped;
import javax.inject.Named;

@Named(value = "fooBean")
@RequestScoped
public class FooBean {
...
}

instead of these:

import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

See also: https://stackoverflow.com/a/9921449/4402950

honza-kasik
  • 292
  • 1
  • 9
0

I was facing somthing like this and it was solved when I used

<p:ajax event="change" update="componenet_ID" process="@form" listener="#{ManagedBeen.action}" />
Temala Ridha
  • 84
  • 1
  • 8
0

In my case, the input values were null, because the object were replace by other object by the aplication. So, we were submiting another object.

We were working in a dynamic lazy list, so we had that issue.

Carlos UCR
  • 299
  • 3
  • 6