Thanks Kevin,
I ended up specfying the url in a variable and accessing it as a variable in
the tag. works fine. thanks for the help.
Jessica
-----Original Message-----
From: Kevin Wang [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 28, 2001 10:30 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Using expressions as attribute values in <html:link>
I don't have the latest html dtd but a peek into _form.dtd confirms that you
CAN use expression for the href attribute.
<tag>
<name>link</name>
<tagclass>org.apache.struts.taglib.form.LinkTag</tagclass>
<attribute>
<name>href</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
assuming same is true for _html.dtd, a possible work around is that you
construct the entire url expression first and then assign to the
<html:link>. something like,
<%
String url = "http://localhost:8080/internal/"+jsp;
%>
<html:link href=<%= url %> />
kevin
> -----Original Message-----
> From: Anderson, Jessica [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 28, 2001 10:04 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Using expressions as attribute values in <html:link>
>
>
> I am still unclear as to the solution to this problem. I am using
> <html:link> tags and there seems to be an issue with using
> jsp expressions.
> I have taken all extra spaces out, I removed the quotes as
> Kevin suggested,
> but had parsing problems - the attribute value must be in
> quotes. Is there
> anyway to pull in a variable as the page attribute value?
>
> Thanks,
> Jessica
>
> -----Original Message-----
> From: Kevin Wang [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 28, 2001 9:53 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Using expressions as attribute values in <html:link>
>
>
> while <bean:write /> works fine inside pair "s, <%= %> does
> not. you need to
> take away the pair of "s here. in this case, you also need to
> make sure that
> no spaces would appear in the entire query string.
>
> here is my example:
>
> <%
> String clazz = obj.getClass().toString();
> clazz = clazz.substring(clazz.indexOf(" ")+1);
> String clazzName =
> clazz.substring(clazz.lastIndexOf(".")+1);
> %>
>
> <a href=/jsp/form.do?action=view&nextUrl=/jsp/detail_commd_<%=
> clazzName.toLowerCase().trim() %>.jsp&objectType=<%=clazz
> %>&primaryKey=<bean:write name="obj" property="primaryKey"
> />> <bean:write
> name="obj" property="name" /></a>
>
> kevin wang
>
> > -----Original Message-----
> > From: Anderson, Jessica [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, February 28, 2001 9:41 AM
> > To: [EMAIL PROTECTED]
> > 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/<%= jsp %>.do ... >
> >
> > Does this feature work a different way? Is there an
> > alternative to using
> > jsp expressions to dynamically generate these href links?
> >
> > Thanks,
> > Jessica
> >
>