You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alan Yackel <ay...@home.com> on 2001/02/15 09:15:41 UTC

Question on html:link

I'm trying write a page with a link back to the referring page.  I can get the page from
<bean:header>, but how would I put a link to this?  I don't see a way to do this.  I'm
thinking that I need to either write a new tag or an action to do handle this.  Or go
ahead and put java code in the .jsp, which I want to avoid.

Thanks for any help,
Alan Yackel


Re: Question on html:link

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Alan Yackel wrote:

> I'm trying write a page with a link back to the referring page.  I can get the page from
> <bean:header>, but how would I put a link to this?  I don't see a way to do this.  I'm
> thinking that I need to either write a new tag or an action to do handle this.  Or go
> ahead and put java code in the .jsp, which I want to avoid.
>
> Thanks for any help,
> Alan Yackel

One approach would be a runtime expression:

    <bean:header id="referer" name="Referer"/>
    <html:link href="<%= referer %>" .../>

which works because the <bean:header> tag creates a scripting variable along with a page
context attribute, in the same way that <jsp:useBean> does.

Otherwise, we would need to enhance the link tag to accept its href from a bean (which is
not a bad idea), and/or you could write a custom tag of your own.

Craig