开发者

validator for characters exceeding size of a text box

I have a table one of whose column is varchar(64). I am building a web form in Java using JSF where the form has a text box where the users type in free text and is saved to the column in the above mentioned table. I need to write a validator to check if the number of characters in the text box exceeds 64 (as it w开发者_开发技巧ill crash when saved to the database). Need some suggestions to write this validator.


You can do something like this

<h:inputText id="username" value="#{user.username}" 
                size="64" required="true"
                label="UserName" >
                <f:validateLength minimum="0" maximum="64" />
            </h:inputText>  
  • Reference
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜