You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Barbara Post <ba...@ifrance.com> on 2002/06/25 15:03:36 UTC

nested:image, image src, nested:write

Hello, I have a bean whose properties are used in a series of  <nested: ...
/> tag.

I also want to have an image whose source is defined by the same bean I am
using properties of. I am doing something wrong (get the nesting level...?).

I started from keyboardmonkey example so follow its structure :

in a first jsp, defining a BuildMenu bean which will create BuildMenuBean
beans :

<!-- here nesting will build menu -->
<nested:root>
  <nested:nest property="buildMenu" >
    <jsp:include page="buildmenu.jsp" />
  </nested:nest>
</nested:root>
<jsp:include page="footer.jsp" flush="true"/>


in my recursive buildmenu.jsp, speaking of BuildMenuBean bean (getting its
values) :

<nested:equal property="showChildren" value="true">
    <!-- here the right image -->
    <nested:image src="<nested:write property="nodePix"/>" />
    <!-- miss some formatting depending on level-->
    <nested:write property="nodeValue"/><br>
    <!-- iterate -->
    <nested:iterate property="childCollection">
      <jsp:include page="buildmenu.jsp" />
    </nested:iterate>
  </nested:equal>

but "attribute nodePix has no value" when I compile. Thanks for the right
tag :-)
It is a property of BuildMenuBean, not BuildMenu. I am just starting my menu
building so would be sure everything is OK in the jsp too.

Thanks a lot.

Babs


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: nested:image, image src, nested:write

Posted by Barbara Post <ba...@ifrance.com>.
Thanks Arron, I was wondering about scriptlet but you're right a programmer
has to be flexible in mind and pragmatic indeed ;-)

Well, maybe the img / image tag could be enhanced LOL. Just kidding.

Babs
----- Original Message -----
> The embedding of the <nested:write> tag inside the <nested:image> tag is
> illegal, because it's bad XML, which means the JSP page will have issues
> with it.
>
> Closest you'll get to doing exactly this is...
>
> <nested:define property="nodePix" id="imgUrl" />
> <nested:image src="<%= imgURL%>" property="myImageProperty" />
>
> The smallest of snippets to get the value out and into the tag, but any
> programmer who has issues with it is simply not the pragmatic variety :)
>
> Enjoy.
>
>
>
> Arron.
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: nested:image, image src, nested:write

Posted by Arron Bates <st...@keyboardmonkey.com>.
> <!-- here nesting will build menu -->
> <nested:root>
>   <nested:nest property="buildMenu" >
>     <jsp:include page="buildmenu.jsp" />
>   </nested:nest>
> </nested:root>
> <jsp:include page="footer.jsp" flush="true"/>

mmmmmmmmm... recursive nesting through includes, cutting edge :)


> <nested:equal property="showChildren" value="true">
>     <!-- here the right image -->
>     <nested:image src="<nested:write property="nodePix"/>" />
>     <!-- miss some formatting depending on level-->
>     <nested:write property="nodeValue"/><br>
>     <!-- iterate -->
>     <nested:iterate property="childCollection">
>       <jsp:include page="buildmenu.jsp" />
>     </nested:iterate>
>   </nested:equal>


The embedding of the <nested:write> tag inside the <nested:image> tag is
illegal, because it's bad XML, which means the JSP page will have issues
with it.

Closest you'll get to doing exactly this is...

<nested:define property="nodePix" id="imgUrl" />
<nested:image src="<%= imgURL%>" property="myImageProperty" />

The smallest of snippets to get the value out and into the tag, but any
programmer who has issues with it is simply not the pragmatic variety :)

Enjoy.



Arron.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>