JSF特立尼达tr:inputText修整 [英] JSF Trinidad tr:inputText trimming

查看:139
本文介绍了JSF特立尼达tr:inputText修整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户在tr:inputText生成的输入中插入空格并提交表单时,我得到在输入中设置的JSF转换器(我的转换器不进行修整)中提交的值.但是我得到了托管bean的空值(输入的原始值).

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页面:

<tr:inputText label="..."
  value="#{ManagedBean.object.defaultValue}" id="defValueId"
  converter="#{MyConverter}">
  <tr:validateLength maximum="255"/>
  <f:attribute name="domainId" value="domainId"/>
</tr:inputText>

当我使用h:inputText时,我将获得提交给托管bean的值.

When I use h:inputText, I get the value that was submitted to my managed bean.

特立尼达为什么在什么地方忽略空格?我可以更改任何内容,使其与h:inputText一样工作.

Why and where does Trinidad ignores whitespaces? Can I change anything so it works as for h:inputText.

注意:我使用JSF 1.2和Trinidad 1.2.13.我不是在这里解决空字符串为null的问题.

Note: I use JSF 1.2 and Trinidad 1.2.13. I am not solving here problem empty string to null.

推荐答案

在JSF表达式语言(EL)中,我们还可以使用JSF表达式语言功能. Facelets支持的表达式语言称为统一表达式 语言.因此,如果我们想在inputText中调用trim函数:

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]}"/>

更多信息: http://java.sun.com/products /jsp/reference/techart/unifiedEL.html

这篇关于JSF特立尼达tr:inputText修整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆