Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cant get value from inputText

 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im trying to get the value from the inputText by using dateInputTxt.getValue, but it return me null value.
i have the following code in jsf:
<h:inputText value="myBean.dateS" id="sdate" binding="myBean.dateInputTxt">

managed bean:
private HtmlInputText dateInputTxt;

dateInputTxt.getValue(). //this return me a null value.


i have tried with hidden text field, and Im able to get the value by using dateInputTxt.getValue().

Why is it that the method .getValue works for hidden field and not text field?

-thanks.


 
Luis Soares
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !

You would have intention of use an expression, but not do it properly. To use expression you must declare it using the format like this : #{expression}.
For example :



Otherwise you can try to set a simple value to component and try get your value.



 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oopz. my bad. some typo here. i did have the #{} for the value and binding.
 
Luis Soares
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how is your implementation of method "getDateS()"
in your "myBean" managed bean ? The result of this method that is assigned to property "value" of this component.
 
lynn fann
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im my managed bean, i only generate the getter and setter method. (the default as what most IDE will auto generate)

do i have to add in any codes?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic