You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Anderson, Jessica" <Je...@trs.state.tx.us> on 2001/02/28 16:40:38 UTC

Using expressions as attribute values in

I have tried to use a jsp expression as the value for the page attribute
(page=<%= jsp %>) but the < and > translate as less than greater than
symbols.  I have also tried using the escape character \ before and after
the < and >, but I get the same result in my source HTML:

<a href="http://localhost:8080/internal/&lt;%= jsp %&gt;.do ... >

Does this feature work a different way?  Is there an alternative to using
jsp expressions to dynamically generate these href links?

Thanks,
Jessica

Re: Using expressions as attribute values in

Posted by Maya Muchnik <mm...@pumatech.com>.
Maybe you need to add <pre>...</pre> HTML tag before your <a> tag.

"Anderson, Jessica" wrote:

> I have tried to use a jsp expression as the value for the page attribute
> (page=<%= jsp %>) but the < and > translate as less than greater than
> symbols.  I have also tried using the escape character \ before and after
> the < and >, but I get the same result in my source HTML:
>
> <a href="http://localhost:8080/internal/&lt;%= jsp %&gt;.do ... >
>
> Does this feature work a different way?  Is there an alternative to using
> jsp expressions to dynamically generate these href links?
>
> Thanks,
> Jessica

Re: Using expressions as attribute values in

Posted by Martin Cooper <ma...@tumbleweed.com>.
Jessica,

I think what you want is this:

<html:link href='<%= "http://localhost:8080/internal/" + jsp + ".do" %>'>

Note that the string concatenation has to happen inside the JSP expression,
and that single quotes are used for the attribute because double quotes are
needed for the string literal.

--
Martin Cooper
Tumbleweed Communications

----- Original Message -----
From: "Anderson, Jessica" <Je...@trs.state.tx.us>
To: <st...@jakarta.apache.org>
Sent: Wednesday, February 28, 2001 7:40 AM
Subject: Using expressions as attribute values in <html:link>


> I have tried to use a jsp expression as the value for the page attribute
> (page=<%= jsp %>) but the < and > translate as less than greater than
> symbols.  I have also tried using the escape character \ before and after
> the < and >, but I get the same result in my source HTML:
>
> <a href="http://localhost:8080/internal/&lt;%= jsp %&gt;.do ... >
>
> Does this feature work a different way?  Is there an alternative to using
> jsp expressions to dynamically generate these href links?
>
> Thanks,
> Jessica