jsf h:消息位置如 rich:message

发布于 2024-12-23 10:32:53 字数 219 浏览 4 评论 0原文

当我在表单中使用 rich:message 时,我在输入字段下方看到消息,颜色为红色并带有 X 图片。

我的问题是如何将 h:message 定位在与 rich:message 相同的位置?或者,从 rich:message 中删除 X 图片。 (我希望能够在输入字段下方看到红色文本,没有任何图片)。

提前致谢。

when I'm using rich:message inside my form , I see the message just under the input field , colored in red and with X picture.

My question is how can I position h:message to be in the same exact place like rich:message? or alternately, to delete the X picture from the rich:message.
(I want to be able to see a red text just under the input field, without any picture).

Thank's In Advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一指流沙 2024-12-30 10:32:53

如果您使用 RichFaces,它们会为您的 message 组件提供漂亮的样式。如果您不想使用它,则必须构建自己的 CSS 样式类来格式化消息组件。原始 JSF 的 组件具有属性 styleClass。您可以使用 CSS 类实现您想要的外观,并将类名称放在那里,如下所示:

<style type="text/css">
   .message { 
      background-color: red;
   }
</style> 

<h:inputText id="myInput" />
<h:message for="myInput" styleClass="message" />

<h:panelGrid columns="3">
   <h:outputText value="Input " />
   <h:inputText id="myInput" />

   <h:outputText />
   <h:message for="myInput" styleClass="message" />
</h:panelGrid>

我的示例不会像 RichFaces 的实现那样显示得那么好。你需要自己弄清楚:P。

If you use RichFaces, they provide you with nice styling for your message component. If you don't want to use it, you have to build your own CSS style class to format the message component. Original JSF 's <h:message> component has the attribute styleClass. You can implement how you want it to look like with CSS class and put the class name there like this:

<style type="text/css">
   .message { 
      background-color: red;
   }
</style> 

<h:inputText id="myInput" />
<h:message for="myInput" styleClass="message" />

<h:panelGrid columns="3">
   <h:outputText value="Input " />
   <h:inputText id="myInput" />

   <h:outputText />
   <h:message for="myInput" styleClass="message" />
</h:panelGrid>

My example will not display as nice as RichFaces's implementation. You need to figure it out yourself :P.

鹤舞 2024-12-30 10:32:53

我发现 此链接准确解释了如何删除rich:message图标。
那里没有提到,但是当引用 css 文件时,它应该在页面加载之后,所以我使用
希望这对某人有帮助。

I found this link which explains exactly how to remove the rich:message icon.
It is not mention there , but when refering a css file it should be after the pages loads, so i used <h:outputStylesheet library="css" name="style.css"/>.
hope this helps someone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文