You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hohlen, John" <JH...@erac.com> on 2002/11/25 21:19:01 UTC

JSTL or Struts Tags: Required Field Indication

My team extended the Struts <bean:message> custom tag to accept an
additional attribute called "required".  If this optional attribute is set
to true, then a red asterisk is appended to the text corresponding to the
key.  For example, the following tag:

 <abc:beanMessage key="login.userId" required="true"/>

would produce the following:

  User ID*

Obviously, placing the code to generate the required field marker in the tag
creates a single isolation point for future changes.  For example, if it
desired to make the asterisk blue instead of red, or to place the asterisk
at the beginning of the label instead of the end.  Otherwise, if this wasn't
part of the tag, then every JSP with a required field would have to be
changed.  More specifically, JSPs would contain the following:

<bean:message key="login.userId"/><font color="red">*</font>

Are others extending the Struts tags to generate the required field marker?
My team is also interested in using JSTL and the "Struts-EL" subproject.  Is
there an existing tag in either of these libraries that could be used?
Unlike the Struts tags, the JSTL tags can't really be extended since you
don't have access to the JSTL implementation (source), correct?  I realize I
could extend the JSTL tags provided via the Jakarta implementation (since
the source is available), but my extensions most likely wouldn't work once I
started using my container's implementation, correct?

Thanks,

JOHN


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>