You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ricky Lee <ja...@yahoo.com> on 2004/06/14 19:32:52 UTC

how to transfer the link value of tiles to the related-URI in html:link tag...

thanks for reading....
 
i know the html tag of struts a little..and in the html:link tag, i can use the page attribute to generate a server-relative URI by including the context path... but now i have a problem. i couldn't nested a <html:link ... /> inside another tag. just like:
 
<tiles:importAttribute name="menus" />
<logic:iterate name="menus" id="menu">
<a href="<bean:write name="menu" property="link" />" target="main"><bean:write name="menu" property="value" /></a></td></tr>
</logic:iterate>
 
because the link property is from the tiles definition named tiles-defs.xml, some definition code like this:
 
<definition name=".admin.leftFrame.console.forum" extends=".admin.leftFrame.console">
 <put name="headline" value="Forum Setting" type="string" />
 <putList name="menus">
   <item value="Add Forum"  link="/page/admin/forumAdd.do" />
    ........
 </putList>
</definition>
 
the URL address i access to the jsp page is   http://localhost:8080/forum/index.jsp
 
if i set the link value to "/page/admin/forumAdd.do", the hyperlink change to http://localhost:8080/page/admin/forumAdd.do  ,   it lost the path "/forum"..
 
how to transfer the link value to the related-URI automatically just like the page attribute of html:link tag..
 
could i use the code like this?
 
<logic:iterate name="menus" id="menu"><html:link page="<bean:write name="menu" property="link" />" target="main"><bean:write name="menu" property="value" /></html:link>
</logic:iterate>
 
i try it.. i couldn't work... maybe i lost something important about struts tag..
 
lastly, i change the code like this:
 
<logic:iterate name="menus" id="menu"> 
<bean:define id="link_str" name="menu" property="link" />
<html:link page="<%=link_str.toString()%>"><bean:write name="menu" property="value" /></html:link>
</logic:iterate>

 
could someone tell me what can i do except this....
 
 
 
 
 

		
---------------------------------
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger