wood burning stoves 2.0*
The moose likes JSF and the fly likes InputText and InputTextArea value null when inside a DataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "InputText and InputTextArea value null when inside a DataTable" Watch "InputText and InputTextArea value null when inside a DataTable" New topic
Author

InputText and InputTextArea value null when inside a DataTable

e park
Greenhorn

Joined: Sep 02, 2009
Posts: 2
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

Joined: Jun 25, 2001
Posts: 15951
    
  19

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


Customer surveys are for companies who didn't pay proper attention to begin with.
e park
Greenhorn

Joined: Sep 02, 2009
Posts: 2
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

Joined: Dec 15, 2004
Posts: 14
I have similar problem. I try to get value from ice:inputTextarea and I get null. Did you find solution?
Mariusz Malinowski
Greenhorn

Joined: Dec 15, 2004
Posts: 14
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

Joined: Feb 22, 2010
Posts: 19
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
 
jQuery in Action, 2nd edition
 
subject: InputText and InputTextArea value null when inside a DataTable
 
Similar Threads
Need inputTextArea functionality + escape="false"
JSF 1.2 Facelets - Component ID form1:dataTable:j_id101 has already been found in the view
inputTextArea
Why does UICompoent.getCurrentComponent sometimes return the parent of the current component?
Usage of inputTextarea in JSF