OK, here's another idea.  I searched the archives for it and couldn't find
it.

How about two simple changes:
1) Add a new renderExtraAttributes() method that gives people the chance to
throw non-standard HTML into their tags that extend from Struts tags.  Here
is a snippet from BaseFieldTag.java:

<snip>
results.append("\"");
results.append(this.prepareEventHandlers());
results.append(this.prepareStyles());
results.append(this.getElementClose());


<matts-idea>
results.append(renderExtraAttributes());
</matt-sidea>

return results.toString();
</snip>

The use cases for this are (a) to support the readonly attribute and (b) to
support the "attributes" extension that was shot down for inclusion in the
out-of-the-box Struts <html> tags.

2) Instead of accessing instance variables directly, use getters.  (I'm not
sure if this will cause problems with the EL versions of tags... thoughts
anyone?)

<snip>
if (accept != null) {
    results.append(" accept=\"");
    //old way
    //results.append(accept);
    //new way
    results.append(getAccept());
    results.append("\"");
}
</snip>

If someone wanted to override the accept attribute so that it was always
equal to foo then they would be able to do so.  A better use case would be
overriding the onclick method so that it does something special like display
a calendar popup.

I apologize in advance if this has been discussed before.  ([OT] I really
wish there was an easier way to search the archives.  I have resorted to
googling them, but it's still a pain.)

Matt
----- Original Message ----- 
From: "Robert Leland" <[EMAIL PROTECTED]>
To: "Struts Developers List" <[EMAIL PROTECTED]>
Sent: Thursday, September 25, 2003 1:41 PM
Subject: Re: Editable Fields V/S Static Text


> Sgarlata Matt wrote:
>
> >Has anyone ever discussed adding a general-purpose "attributes" attribute
to
> >the <html> tag library to support non-standard HTML like this?  For
example,
> >
> >
> Yes, it was vetoed by several committers. Search the archives.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to