English 中文(简体)
JSF 编号
原标题:JSF Number Validation
  • 时间:2011-11-16 08:27:34
  •  标签:
  • jsf

是否在共同基金中设有任何固定编号有效编号标签,以检查输入<编码>h:inputext。 实地是多少?

第一个问题得到了回答。 愿意解释下一个问题:

<h:inputText id="maxrecs" value="#{simpleBean.numRecords}" required="false" maxlength="4" >                         
    <f:convertNumber longOnly="true"/>
</h:inputText>

背井离乡

private long numRecords = null;

如果我使用“强硬”标语,那么价值就没有确定。 现在,当我使用原始字塔时,正在屏幕上印刷0。 我希望屏幕空洞。

最佳回答

You can use f:convertNumber (use the integerOnly attribute).

http://www.jsftool Box.com/documentation/help/12-TagReference/core/f_convertNumber.html”rel=“noreferer”>here

问题回答

JSF Number validation for inputtext mention f:converterNumber component in between h inputText component and mention the attributes integerOnly and type.

<h:inputText id="textMobileId" label="Mobile" styleClass="controlfont" value="#{UserRegistrationBean.textMobile}">
    <f:convertNumber integerOnly="true" type="number" />
</h:inputText>

如果在你点击布顿时,你进入移动文本箱,就会自动显示像这样的错误。

Mobile:  abcd  is not a number. 

i8taken solution converts number into long without validation message (at least in my case: JSF2 / global messages per page). For proper validation message you can
1. check value in action method in bean;
or
2. use converter attribute for inputText:

<h:inputText id=“maxrecs” Value=“#{simpleBean.numRecords}” maxlength=“4”换算器=“javax.faces.Integer”/>

你可以简单地利用通行证,从而首先增加这一图书馆。

    xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"

在使用后

   <h:inputText id="numberId" pt:type="number" />




相关问题
JSF a4j:support with h:selectManyCheckbox

I m having trouble with a JSF selectManyCheckbox and A4J support. The purpose is to run some action when a checkbox is selected. This works perfectly in Firefox. Yet, when testing in any IE (ie6 / ie7 ...

Mojarra for JSF Encoding

Can anyone teach me how to use mojarra to encode my JSF files. I downloaded mojarra and expected some kind of jar but what i had downloaded was a folder of files i don t know what to do with

如何拦截要求终止?

在共同基金中,如果用户要求终止,就需要采取一些行动。 我需要某种拦截器,但我不知道如何这样做。 我需要帮助。 增 编

ICEFaces inputFile getting the file content without upload

Is there any way of just getting the content of the browsed file without any upload/file transfer operations? I currently use ICEFaces inputFile component but I do not need the default uploading ...

Weird behaviour of h:commandLink action (MethodExpression)

I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

How to correctly use ResultSet with h:dataTable

The problem is, that after displaying the ResultSet with <h:dataTable>, the connection is left open. If I close it, it closes the ResultSet too. I m thinking about copying the ResultSet data ...

热门标签