Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

InputText and InputTextArea value null when inside a DataTable

 
e park
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm having issues pulling inputText and inputTextArea fields when they reside inside of a data table. I'm writing a common utility bean that will be utilized by all my managed beans so pulling the values using the getters is not an option. ie: i won't know which getters to call. I'm currently pulling the input fields by traversing the UIComponent tree. see code below


The code works fine when the input field is outside of a datatable, it pulls nulls when these same fields are inside of a data table. I'm currently using <rich:dataTable>. Can anyone tell me why the value holder is null when the input is inside of a data table and how I can retrieve the value when it is?
Thanks
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17621
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably because your table data model is in a request-scope object and is being destroyed (and re-created empty) between requests.

See http://www.coderanch.com/t/460912/JSF/java/ArrayList-populated-table-doesn-t#2057783
 
e park
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The managed bean that contains the table data model is defined as session scope. Is there something else I need to set on the dataTable in the jsp? The only thing I see that I can set scope on within my jsp's are my c:set variables. Thanks
 
Mariusz Malinowski
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have similar problem. I try to get value from ice:inputTextarea and I get null. Did you find solution?
 
Mariusz Malinowski
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, this problem is related with jsf page life cycle:

http://forums.sun.com/thread.jspa?threadID=736104

So whenever you try to get value for the first time you will get null. Second attempt will give you expected value.
 
Prabu Pidaran
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also facing the same problem. I am having selecOneMenu and inputTextArea in my datatable. I am getting null for the first time and from second time onwards am getting the values entered in InputTextArea. I am using jsf1.1. Is there any solution or work around to solve this issue....???

My bean scope is 'Session'. am able to get the new values in valuechangelistener. But when am doing update, am getting null.

(This is my first post in any website. Happy to be a member in coderanch. Hope will get a solution for my problem)

Thanks in advance ...
Prabu
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic