You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pavlikus <pa...@bk.ru> on 2004/06/21 16:04:35 UTC

html-el:link and url from resources

Hi all. My menus defined in resources file.

Like that:
user-menu.profile =Edit profile
user-menu.profile.link =/EditProfile.do
user-menu.profile.tooltip =Edit your preferences

Now, when i want to show menu items, I run into unexpectedness.
I can't show url in html:link tag. Instead it shows the property key.
How can I do that?

My code:

<%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
<%@ taglib uri="/tags/struts-html-el" prefix="html" %>
<%@ taglib uri="/tags/struts-bean-el" prefix="bean" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<tiles:importAttribute />


<jsp:useBean id="userMenuList" class="java.util.Vector" scope="page"/>

<c:forEach items="${userMenuList}" var="item">
  <html:link href="${item.link}">
     <bean:message key="${item.value}"/>
   </html:link>
   <br>
</c:forEach>

I tried to put <bean:message key="${item.link}"/> into html:link href
- but it is not valid jsp construction. Also I tried to use <a
href="<bean:define...>"> - that don't work too.




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


Re: html-el:link and url from resources

Posted by Nicolas De Loof <ni...@capgemini.com>.

You can use this : 

<c:forEach items="${userMenuList}" var="item">
  <c:set var="link">
    <bean:message key="${item.link}"/>
  </c:set>
  <html:link page="${link}">
     <bean:message key="${item.value}"/>
   </html:link>
   <br>
</c:forEach>


Nico.

----- Original Message ----- 
From: "Pavlikus" <pa...@bk.ru>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Monday, June 21, 2004 4:04 PM
Subject: html-el:link and url from resources


> Hi all. My menus defined in resources file.
> 
> Like that:
> user-menu.profile =Edit profile
> user-menu.profile.link =/EditProfile.do
> user-menu.profile.tooltip =Edit your preferences
> 
> Now, when i want to show menu items, I run into unexpectedness.
> I can't show url in html:link tag. Instead it shows the property key.
> How can I do that?
> 
> My code:
> 
> <%@ taglib uri="/tags/struts-tiles" prefix="tiles" %>
> <%@ taglib uri="/tags/struts-html-el" prefix="html" %>
> <%@ taglib uri="/tags/struts-bean-el" prefix="bean" %>
> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
> 
> <tiles:importAttribute />
> 
> 
> <jsp:useBean id="userMenuList" class="java.util.Vector" scope="page"/>
> 
> <c:forEach items="${userMenuList}" var="item">
>   <html:link href="${item.link}">
>      <bean:message key="${item.value}"/>
>    </html:link>
>    <br>
> </c:forEach>
> 
> I tried to put <bean:message key="${item.link}"/> into html:link href
> - but it is not valid jsp construction. Also I tried to use <a
> href="<bean:define...>"> - that don't work too.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


Our name has changed.  Please update your address book to the following format: "recipient@capgemini.com".

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.


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