Reputation: 47
I have a dropdownbox and an inputText. Here is my xhtml codes:
<h:panelGroup id="inputs">
<h:selectOneMenu value="#{tabBean.refundCharge}" name="reCharge">
<f:selectItems value="#{tabBean.reChargeList}" />
<f:ajax render="inputs" />
</h:selectOneMenu>
<p:inputText value="#{tabBean.refundDescr}" rendered="#{tabBean.refundCharge == 'Item2'}"/>
</h:panelGroup>
And this is TabBean :
private String refundCharge;
public String[] getReChargeList() {
ResourceBundle config = ResourceBundle.getBundle("config");
String reChargeList= "Item1 % Item2 % Item3";
String delimeter = "[%]";
String[] reChargeDescr = reChargeList.split(delimeter);
return reChargeDescr;
}
The inputText is not shown.When I clicked Item2 value from the dropDownList, The input Text must be shown. But it isn't work by these codes.
It must be shown just when I clicked Item2. Where is the error?
Thanks
Upvotes: 1
Views: 850
Reputation: 1109745
You have a space before and after every %
in the reChargeList
. So effectively the split values are "Item1 "
, " Item2 "
and " Item3"
. The " Item2 "
does not equal to "Item2"
which you've specified in rendered
attribute and hence it will never be rendered.
Remove those spaces or change your split delimiter to \\s*%\\s*
Upvotes: 3