struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Jones" <alex.jo...@unclealex.co.uk>
Subject RE: Using a tag to provide value for attribute of another tag
Date Wed, 24 Apr 2002 12:14:31 GMT
Or maybe another way of this problem could be to define tags that can
have sub-nodes instead of elements. For example, instead of <bean:define
id="door" name="mouse"/> you would be able to write:

<bean:define>
  <id>door</id>
  <name>mouse</name>
</bean:define>

Then 'door' and 'mouse' could be substituted by any valid XML
expression.

Is this idea reasonable? I've little experience of writing tags.

Cheers,
Alex

-----Original Message-----
From: Nicolas De Loof [mailto:nicolas.deloof@cgey.com] 
Sent: 24 April 2002 12:31
To: Struts Users Mailing List; andrew.david.hill@gridnode.com
Subject: Re: Using a tag to provide value for attribute of another tag

JSP tags use XML syntax, so while parsing your code JSP parser sees:
"my:tag" tag begins
"something" attribute setted to value "<bean:message key="
"foo.bar" attribute without value declaration

You cannot nest jsp:tags into attribute declaration as you did.
You might add an optional "key" attribute to your my:tag, or define a
script
variable that you can use as :

<my:tag something="<%=scritpVariable%>"/>

I don't think there is a way to use bean:message or bean:define to
define
such a variable from a key search in ApplicationRessources, perhaps it
could
be a request for next version of Struts tags : add an id attribute and
define mecanism to bean:message ?

> <my:tag something="<bean:message key="foo.bar"/>"/>
>
> However this results in an exception of the form:
> ServletException in:/WEB-INF/thinghy/wotsit.jsp]
> /WEB-INF/thinghy/wotsit.jsp(22,63) Attribute foo.bar has no value'
>
> If I use <bean:message key="foo.bar"/> on its own it finds the
appropriate
> value ok.
>
> Im still quite new to this and am not sure how I should be approaching
this
> problem.
>
> My original idea was to just pass "foo.bar" as the attribute and have
the
> tag look up the internationalised value. Upon realising I had no idea
how
to
> do this I figured Id try the above approach, which has also proven
> unsuccessful. :-(
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>





--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message