David,

   First, thanks for taking time to reply.  I think I prefer your first
approach over the second.  Our users want to see a red asterisk next to the
required field name.
   However, the one drawback I see with your suggested approach is if we
decide to make the required field marker (again, a red asterisk) a prefix
instead of a suffix, we have to modify every JSP.  In other words, globally
changing the character/color for the required field indication can be
controlled via the "resource bundle" and "stylesheet".  But changing, it's
location can't -- unless we extend the Struts tags.  But, we really want to
keep the number of Struts tags that we extend to a minimum, as that will
minimize the pain when migrating to new releases of Struts.

JOHN  

-----Original Message-----
From: David Graham [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 25, 2002 2:45 PM
To: [EMAIL PROTECTED]
Subject: Re: JSTL or Struts Tags: Required Field Indication


I've defined a message in my resource bundle like this:
required.icon=<span class="required">*</span>

and I output it like this <fmt:message key="required.icon/> next
to my field names.

Alternatively, you could use standard <label> elements and apply a style to 
them so they show up in red or bold (i.e. <label for="username" 
class="required">).

Both these approaches don't require tag subclasses.

David






>From: "Hohlen, John" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts-User (E-mail)" <[EMAIL PROTECTED]>
>Subject: JSTL or Struts Tags: Required Field Indication
>Date: Mon, 25 Nov 2002 14:19:01 -0600
>
>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:   
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


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

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

Reply via email to