Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i change the color of an error message in stripes framework

Tags:

java

jsp

stripes

I am trying to change the color of error message. I am using a Stripes validation.If the validation failed, I am sending a error message. I wanted it in red color.But it shows in black color. How can i change the color of error message in Stripes framework.

Following is what i have tried.

        <div class="item">

            <stripes:errors />
            <stripes:form name="home"action="/home.action">
                //contents
              </stripes:form>
        </div>
like image 576
Aragon Avatar asked Nov 09 '22 19:11

Aragon


1 Answers

As Vinoth says you can apply CSS classes to change the appearance of error messages. In addition to that, Stripes messages can be fully customized by editing StripesResources.properties.

Here you can define exactly what your messages will look like, using markup and CSS classes, or even inline styles.

# 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>

As you can see you can add extra fancy stuff like FontAwesome icons (admitted, this goes a little further than OP asks for).

like image 139
Richard Osseweyer Avatar answered Nov 14 '22 23:11

Richard Osseweyer