On 5/8/06, Raghuveer <[EMAIL PROTECTED]> wrote:

Is it possiable in struts to show a label in different colours.
I.e Identfying label and showing in different color if the related html
object is having any errors

In below example i need to show label User Name in red color if there is any
data error in
Nested tag <nested:text  property="userName"

You could use the "messagesPresent" and "messagesNotPresent" tags to
do this, but its a bit cumbersome:

http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-logic.html#messagesPresent
http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-logic.html#messagesNotPresent

for example...

<logic:messagesPresent property="userName">
 <font color="red>User Name:</font>
</logic:messagesPresent>
<logic:messagesNotPresentproperty="userName">
 User Name:
</logic:messagesNotPresent>

The alternative is to write your own custom label tag that checks for
the presence of error messages in the same ways as these tags and
emits whatever html you want, wrapped around the label text.

Niall

Example :User Name

<nested:text  property="userName" size="26" maxlength="20"
styleClass="inputtype"  errorStyle="background-color: red"
errorStyleClass="inputtypeerror" /></td>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to