问题
When user inserts white spaces in input generated by tr:inputText and submits form I get the value that was submitted in JSF converter (my converter does no trimming) set on the input. But I get null value (original value that came to the input) to managed bean.
JSF page:
<tr:inputText label="..."
value="#{ManagedBean.object.defaultValue}" id="defValueId"
converter="#{MyConverter}">
<tr:validateLength maximum="255"/>
<f:attribute name="domainId" value="domainId"/>
</tr:inputText>
When I use h:inputText, I get the value that was submitted to my managed bean.
Why and where does Trinidad ignores whitespaces? Can I change anything so it works as for h:inputText.
Note: I use JSF 1.2 and Trinidad 1.2.13. I am not solving here problem empty string to null.
回答1:
Within JSF Expression Language (EL), we could use JSF Expression Language functions in addition. The Expression Language supported by Facelets is called Unified Expression Language. Therefore, if we want to invoke a the trim function in a inputText:
<h:inputText value="#{trim[ramdomText]}"/>
Further info: http://java.sun.com/products/jsp/reference/techart/unifiedEL.html
来源:https://stackoverflow.com/questions/5636360/jsf-trinidad-trinputtext-trimming