gpt4 book ai didi

java - 我如何更改条纹框架中错误消息的颜色

转载 作者:搜寻专家 更新时间:2023-10-31 20:32:55 24 4
gpt4 key购买 nike

我正在尝试更改错误消息的颜色。我正在使用 Stripes 验证。如果验证失败,我将发送一条错误消息。我想要它的红色。但它显示为黑色。如何更改 Stripes 框架中错误消息的颜色。

以下是我尝试过的。

        <div class="item">

<stripes:errors />
<stripes:form name="home"action="/home.action">
//contents
</stripes:form>
</div>

最佳答案

正如 Vinoth 所说,您可以应用 CSS 类来更改错误消息的外观。除此之外,还可以通过编辑 StripesResources.properties 完全自定义 Stripes 消息。

在这里,您可以使用标记和 CSS 类,甚至是内联样式,准确定义消息的外观。

# Resource strings used by the <stripes:errors> tag when there are no nested tags
stripes.errors.header=<div class="my-error-wrapper"><h4>Ooops... some things went awfully awry:/h4><ol>
stripes.errors.beforeError=<li><i class="fa fa-warning"></i>&nbsp;
stripes.errors.afterError=</li>
stripes.errors.footer=</ol></div>

# Resource strings used by the <stripes:errors> tag when displaying errors for a
# specific field (e.g. <stripes:errors field="password"/>). If not supplied the
# values above will be used instead.
stripes.fieldErrors.header=
stripes.fieldErrors.beforeError=<span class="my-error-inline"><i class="fa fa-warning"></i>&nbsp;
stripes.fieldErrors.afterError=</span>
stripes.fieldErrors.footer=

# Resource strings used by the stripes:messages tag
stripes.messages.header=<div class="my-message-wrapper"><ul>
stripes.messages.beforeMessage=<li>
stripes.messages.afterMessage=</li>
stripes.messages.footer=</ul></div>

如您所见,您可以添加额外的花哨内容,例如 FontAwesome图标(承认,这比 OP 要求的更进一步)。

关于java - 我如何更改条纹框架中错误消息的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35741406/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com