wood burning stoves 2.0*
The moose likes JSF and the fly likes Please Help : Problem getting submitted value for dynamic input text field    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Please Help : Problem getting submitted value for dynamic input text field    " Watch "Please Help : Problem getting submitted value for dynamic input text field    " New topic

Please Help : Problem getting submitted value for dynamic input text field


Joined: May 03, 2006
Posts: 2
I am adding, dynamically, text field when a value is selected from a (static)dropdown. There are other static fields in the JSF/JSP page too.

My problem is : On pressing a command button, in my action method, i am not able to get the user-entered value of the dynamic text field. I am able to get the values from the static fields.

I create the dynamic text field by creating a Panel and adding the HtmlInput text field in my managed bean. I then do a Value binding for this field. I bind it to a variable in the managed bean. But i am not getting any value of this variable. PLEASE HELP.

here is the code :
<h:panelGrid id="panelgrid1" columns="2">
<h:panelGroup id="panelgroup1" binding="#{TradeDetailsPageBean.groupPanel}">
Here the dynamic input fields will be added.

<div class="field">
<h:selectOneMenu id="filterName" onchange="this.form.submit()" styleClass="formInputs" value="#{TradeDetailsPageBean.filterName}" valueChangeListener="#{TradeDetailsPageBean.setFilterOnChange}">
<f:selectItems value="# TradeDetailsPageBean.availableTradeFilters}"/>

<div class="field">
<span><h:commandButton id="searchButton" action="#{TradeDetailsPageBean.searchDetailsResultsAction}"styleClass="btns" value="Search" />

Backing bean code:
private String textVal; // the String attached to the dynamic input field

public String getTextVal()
return textVal;
public void setTextVal(String textVal)
this.textVal = textVal;

public void setFilterOnChange(ValueChangeEvent valChangeEvent)
String filterName = (String) valChangeEvent.getNewValue();

private void populatePanel(String filterName)
FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
FilterTO fltTO = (FilterTO) htAvailableTradeFilters.get(filterName);
List rules = fltTO.getRules();


if(rules != null) {
for(int i = 0; i < rules.size();i++)
FilterRuleTO fltRule = (FilterRuleTO)rules.get(i);
String valueType = fltRule.getValueType();
if(valueType != null && valueType.equalsIgnoreCase("prompt"))
UIOutput label = new UIOutput();

//UIInput inputText = new UIInput();
HtmlInputText inputText = new HtmlInputText();
ValueBinding inputValBind = application.createValueBinding("#{TradeDetailsPageBean.textVal}");

public String searchDetailsResultsAction()
System.out.println("The input text field entered value is "+textVal+" hello "+getTextVal()); // This is coming as null
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958


Welcome to the JavaRanch!

Our Naming Policy requires that your display name not be a single word. If you could change it to "Prashant Kumar" (as 2 words), we'd really appreciate it.

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: Please Help : Problem getting submitted value for dynamic input text field
Similar Threads
JSF ValueChange problems and Default method where the form submits to
Difference Between JSF request and HttpServletRequest and how do you retreive parameters from them
Clearing forms
Add component on a button click
Dynamic t:dataTable display oddness.