ITeye博客

:form prependId = false

javaeye_mao · 2012-06-27 11:59 · WEB · Web前端 · Markdown

f you care to see the HTML source from your browser, you will find out that the id of your input field is <form-id>+":"+<input-field-id>, in your case, j_idt7:UserId:. Try to give your<h:form> some meaningful id in order to make some sense out of it. You can read about JSF IDs here. In case you don't like it, you can turn it off by modifying your form tag to something like this,

<h:form prependId = false> // its true by default.

But that might turn out to be problematic, as pointed out by BalusC here.

Furthermore, it seems like you have never configured any validation messages yourself. Which in turn ends up with this message. Hence, a message.properties file is needed to have a control over message and show something more appropriate. Even then the field name should not be the part of the message, to make those validation message generic to avoid repetition. See BalusC's answer regarding the use of label attribute inside the <h:inputText>.

 

http://stackoverflow.com/questions/4385118/jsf-2-why-the-form-id-prefix-in-the-hmessage-output/4390231

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。