You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bryce Fischer <br...@berzerker-soft.com> on 2004/01/17 03:34:24 UTC
setting link inside logic:iterate
What I'm trying to do is create a list of items from an ArrayList in the
session.
My list is an Array list of objects. Here's the interface:
public interface SecurityMenuView {
/**
* Returns the Struts Action for the given Menu item
*
* @return
*/
String getAction();
/**
* Returns the label for the given menu item.
*
* @return
*/
String getLabel();
}
Now, this is what I'd like to do in my jsp (it obviously doesn't work..).
<logic:iterate id="link" name="userView.menuList">
<li><html:link action="link.action"></li>
</logic:iterate>
So.. I'd like to set the action to the link element's "action" property.
Does anyone know a good way to do this? I've tried doing this too:
<logic:iterate id="link" name="userView" property="menuList">
<li><a href='<bean:write name="link"
property="action"/>'><bean:write name="link" property="label"/></a>
</logic:iterate>
but it means hard coding the path to the action (i.e., "/my-app/action.do".
Thanks.
--
Bryce Fischer <br...@berzerker-soft.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: setting link inside logic:iterate
Posted by Mark Lowe <ma...@talk21.com>.
<logic:iterate id="link" name="userView" property="menuList">
<html:link page="<%= link.getAction() %>">
<bean:write name="link" property="label" />
</html:link>
</logic:iterate>
or
<c:forEach var="link" value="${userView.menuList}">
<a href="<c:url value="${link.action}">
<c:out value="${link.label}" />
</a>
</c:forEach>
or
<c:forEach var="link" value="${userView.menuList}">
<html-el:link page="${link.action}">
<c:out value="${link.label}" />
</html:link>
</c:forEach>
Cheers Mark
On 17 Jan 2004, at 02:34, Bryce Fischer wrote:
> What I'm trying to do is create a list of items from an ArrayList in
> the
> session.
>
> My list is an Array list of objects. Here's the interface:
>
> public interface SecurityMenuView {
> /**
> * Returns the Struts Action for the given Menu item
> *
> * @return
> */
> String getAction();
>
> /**
> * Returns the label for the given menu item.
> *
> * @return
> */
> String getLabel();
> }
>
> Now, this is what I'd like to do in my jsp (it obviously doesn't
> work..).
>
> <logic:iterate id="link" name="userView.menuList">
> <li><html:link action="link.action"></li>
> </logic:iterate>
>
> So.. I'd like to set the action to the link element's "action"
> property.
> Does anyone know a good way to do this? I've tried doing this too:
>
> <logic:iterate id="link" name="userView" property="menuList">
> <li><a href='<bean:write name="link"
> property="action"/>'><bean:write name="link" property="label"/></a>
> </logic:iterate>
>
> but it means hard coding the path to the action (i.e.,
> "/my-app/action.do".
>
> Thanks.
>
> --
> Bryce Fischer <br...@berzerker-soft.com>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org