The main reason not to do it that way is the number of attributes involved and the combinatoric explosion involved in handling things that way -- especially since most of them are optional.

It's not just attributes that have a 'foo' and a 'fooKey' that are the issue. Writing foo="${foo}" is not equivalent to leaving the 'foo' attribute unspecified even when the tag file is itself invoked with no 'foo' attribute :-(

L.

Kishore Senji wrote:
I don't know how much of work it would be to modify those tags, however, just wondering why you wouldn't want to have such logic outside the actual struts tag.

You could have logic in the tag file which, If both "alt" and "altKey" or just "alt" is given, uses "alt" value and if just "altKey" is given then fetches the value from the message resources using <bean:message/> and uses that.
<html:text property="${property}" alt="${resolvedAltValue} .../>


On 9/10/05, Laurie Harper <[EMAIL PROTECTED]> wrote:

This isn't really Struts specific, but I'm trying to wrap some of the
Struts HTML tags with tag files (in order to compose them into more
complex 'controls') and I'm running into a slight problem... Some
attributes are mutually exclusive (e.g. 'alt' vs. 'altKey'). I can't see
a way to pass attributes through from the tag file to the Struts tag
that works with this constraint. For example, if I write a tag file like
this:

<[EMAIL PROTECTED] name="property" required="true" rtexprvalue="true"%>
<[EMAIL PROTECTED] name="alt" required="false" rtexprvalue="true"%>
<[EMAIL PROTECTED] name="altKey" required="false" rtexprvalue="true"%>
...
<html:text property="${property}" alt="${alt} altKey="${altKey}" .../>

then, regardless of whether I set alt and/or altKey in the call to the
tag file, the html:text tag complains that I can't specify both
attributes. I've tried passing in the values using "${empty alt ? null :
alt}" but get the same result.

Does anyone know a way to work around this (i.e. a 'correct' way to
pass-through attributes from tag files to custom tags)?

Failing that, how big a deal would it be to change the Struts tags to
treat the empty string equivalently to 'null' when performing these
checks? [I'll happy put together a patch to do that]

L.


---------------------------------------------------------------------
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