在JSF中使用消息捆绑包时,从验证消息中删除组件ID [英] Removing the component Id from validation message when using message bundle in JSF

查看:79
本文介绍了在JSF中使用消息捆绑包时,从验证消息中删除组件ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在练习JSF.我创建了一个包含用户ID和密码字段的登录屏幕.现在,两个输入字段都具有required ="true".我创建了message.properties文件,并向其中添加了以下验证ID,

I am practising JSF. I created a login screen with user Id and password fields. Now both the input fields have required="true". I created message.properties file and added the below validation Id to it,

javax.faces.component.UIInput.REQUIRED = {0}是必填字段

我将message-bundle添加到faces-config.xml.

I added message-bundle to the faces-config.xml.

否,当我单击未提供任何字段值的提交时,显示的消息如下,

No when I click the submit without any field value given, the message shown is as below,

j_idt13:用户ID为必填字段

我想从邮件中删除该 j_idt13 . 怎么做?

I want to remove that j_idt13 which is the component Id from the message. How to do it?

谢谢

推荐答案

在输入组件中,使用属性label代替ID:

In the input components, use the attribute label to show that instead of the id:

<h:inputText .. label="User Id" />

这篇关于在JSF中使用消息捆绑包时,从验证消息中删除组件ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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