You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sri Sankaran <Sr...@sas.com> on 2002/10/02 15:51:49 UTC
[Nested] Getting value from parent during iteration
Using Struts 1.0.2 and Nested extension
The value attribute doesn't support the nested syntax of walking up a tree a la "../foo". How is this result achieved?
In my JSP I have the following
<nested:root name="dependencies">
<nested:iterate property="types">
<nested:equal property="name" value="../currentType">
Do stuff
</nested:equal>
</nested:iterate>
</nested:root>
class DepBean { // available with session key 'dependencies'
private String currentType;
private Collection types;
public String getCurrentType() { return currentType; }
public Collection getTypes() { return types; }
...
}
public class DepType {
private String name;
public String getName() { return name; }
...
}
Even if I resort to specifying the value using a scriptlet, how can I get at the DepBean without having
<%
DepBean foo = (DepBean)session.getAttribute("dependencies");
String currentType = foo.getCurrentType();
%>
and changing the <nested:equal> to
<nested:equal property="name" value="<%=currentType%>">
Is this my only option?
Sri
RE: [Nested] Getting value from parent during iteration
Posted by Phase Web and Multimedia <ma...@phase.ws>.
This might be a suggested enhancement ala propertyValue="../foo" for the
nested:equal and all like comparative tags. Post it on the dev board. I
could see where it would be useful for sure.
Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws
> -----Original Message-----
> From: Sri Sankaran [mailto:Sri.Sankaran@sas.com]
> Sent: Wednesday, October 02, 2002 7:52 AM
> To: Struts-User
> Subject: [Nested] Getting value from parent during iteration
>
>
> Using Struts 1.0.2 and Nested extension
>
> The value attribute doesn't support the nested syntax of walking
> up a tree a la "../foo". How is this result achieved?
>
> In my JSP I have the following
>
> <nested:root name="dependencies">
> <nested:iterate property="types">
> <nested:equal property="name" value="../currentType">
> Do stuff
> </nested:equal>
> </nested:iterate>
> </nested:root>
>
> class DepBean { // available with session key 'dependencies'
> private String currentType;
> private Collection types;
> public String getCurrentType() { return currentType; }
> public Collection getTypes() { return types; }
> ...
> }
>
> public class DepType {
> private String name;
> public String getName() { return name; }
> ...
> }
>
> Even if I resort to specifying the value using a scriptlet, how
> can I get at the DepBean without having
>
> <%
> DepBean foo = (DepBean)session.getAttribute("dependencies");
> String currentType = foo.getCurrentType();
> %>
>
> and changing the <nested:equal> to
>
> <nested:equal property="name" value="<%=currentType%>">
>
> Is this my only option?
>
> Sri
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>