Before I have used methods with arguments to obtain the values of a component on my JSF page, for example
<h:dataTable value="#{myBean.getMyList(argument)}">
However now I need the same principle, but using it on a value attribute of an inputText element, so it would be more or less like this:
<h:inputText value="#{myBean.getMyValue(argment)}">
The problem is that the second method will not invoke the setter method, when executing the element from af:ajax element.
What would be another way of passing values to the setter and getter methods on the backingBean?.
Thanks a lot.
It's indeed not possible to set a value on an EL expression which does not represent a getter. You'd need to turn myValue
into a Map<String, Object>
and use the following notation.
<h:inputText value="#{myBean.myValue[argument]}">
This will then call the put()
method on the Map
. Note that you don't need a setter for myValue
here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.