I wrote a tag that will do the '*' thing, and also turn the fields a different color if they are in error, along with a few other goodies.

There is an open issue for something similar to be added to the Struts codebase here:

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18015

See the link to Matt's variation of what I originally wrote and see how it compares to what you did. I agree that more in this area is needed. Mine is a bit less verbose than yours:

<custom:label key="FormName.fieldName"/>

Field labels are in our resources by that key, and by breaking that key up a little it figures out the rest from the validator metadata and ActionErrors collection. Even the FormName is a bit redundant since its always nested in an <html:form> and thus the form name could be gotten from that parent tag (but would be confusing for developers later looking at the JSP trying to figure out which key its using since you'd have to look at struts-config to figure out the form name).

Erik


On Tuesday, June 24, 2003, at 05:52 PM, Ranjangaonkar, Vaibhav (HQP) wrote:


Hi all,

I have written a custom tag by extending MessageTag from
taglib.bean to display a * after a label. This * should
be displayed after the label if the corresponding property
is specified as 'required' in validation.xml

Example :

<valid:label key="label.firstName"
             property="firstName"
             formName="subscribeForm" />

I can post the code if needed, just wanted to know if there
is already something like this or can this tag be improved.

Thanks.


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



Reply via email to