简体   繁体   English

JSF 2 h:messages出现在表单的末尾

[英]JSF 2 h:messages appears on the end of the form

I have a screen which is implemented in JSF2 and I have validations on some of the fields, and when an error appears for a field that has no 我有一个在JSF2中实现的屏幕,并且我对某些字段进行了验证,并且当没有字段的字段出现错误时,

<h:message for="fieldName" />

it always appear on the end of the screen with no style 它总是以没有样式的形式出现在屏幕的末端

I want to hide the messages summary even if I don't handle those validations 即使我不处理这些验证,我也想隐藏消息摘要

I guess they are just warnings that you see when your project stage is set to Development . 我想它们只是在项目阶段设置为Development时看到的警告。

In web.xml file, change: web.xml文件中,更改:

<context-param>
  <param-name>javax.faces.PROJECT_STAGE</param-name>
  <param-value>Development</param-value>
</context-param>

to: 至:

<context-param>
  <param-name>javax.faces.PROJECT_STAGE</param-name>
  <param-value>Production</param-value>
</context-param>

and the messages disappear. 和消息消失。

It is a feature of JSF 2 that shows you diagnostic messages when you are on Development stage. 它是JSF 2的一项功能,当您处于Development阶段时,它会向您显示诊断消息。 Actually you should changed that value in web.xml only when you want to put the project in production. 实际上,仅当您要将项目投入生产时,才应该在web.xml更改该值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM