You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Kennedy <da...@dksy.net> on 2006/09/12 01:09:00 UTC

Use html:link in User defined Tag

Hi,
I am trying to create a link on a page with the following URL
  http://localhost:8080/<context>/<module>/list.do

This JSP code specifies the <module>
  <html:link module="/upload" action="/upload">Upload</html:link>
produces this link
  http://localhost:8080/<context>/upload/upload.do

But, this Java code in a Tag
  out.print("<a href=\"upload.do\">Upload</a>");
produces this link 
  http://localhost:8080/<context>/<module>/upload.do


How can I specify the <module> in a user defined Tag?
Is it possible to use <html:link in a user defined Tag?


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


Re: Use html:link in User defined Tag

Posted by Adam J Samere <as...@rochester.rr.com>.
I'm assuming you are writing your own custom tag and rendering the link 
inside the tag definition. If this is the case you may wish to have a 
look at the org.apache.struts.taglib.TagUtils class. One of the 
overloaded computeURL methods may provide the functionality you are after.

Adam

Dave Kennedy wrote:
> Hi,
> I am trying to create a link on a page with the following URL
>   http://localhost:8080/<context>/<module>/list.do
>
> This JSP code specifies the <module>
>   <html:link module="/upload" action="/upload">Upload</html:link>
> produces this link
>   http://localhost:8080/<context>/upload/upload.do
>
> But, this Java code in a Tag
>   out.print("<a href=\"upload.do\">Upload</a>");
> produces this link 
>   http://localhost:8080/<context>/<module>/upload.do
>
>
> How can I specify the <module> in a user defined Tag?
> Is it possible to use <html:link in a user defined Tag?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   



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