You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinod Kumar <vk...@yahoo.com> on 2006/10/03 20:48:18 UTC

how to escape double quotes in html:link

Hi All,
    I am trying to create a list of html links
dynamiclly. I have a collection of links. My HyperLink
class has one linkURL field and another linkDesc field
(its a javabean). 

When I iterate thru these links, the double quotes are
causing problem and i have tried every possible
combination which I know( eg. adding a /" etc).

This line in below code is causing problem.
<html:link action="<bean:write  name="link"
property="linkURL" />" >

can anyone help me to fix this. Appreciate your help.


<logic:iterate id="link" name="links" scope="session"
type="com.abc.app.DTO.HyperLink">
<tr>
<td align="left" width="10"><img src="/img/s.gif"
width="10" height="1" alt=""></td>
<td align="left" valign="top" width="10"
class="color003366"><span
style="font-weight:bold">&raquo;</span></td>
<td align="left" width="130">
<html:link action="<bean:write  name="link"
property="linkURL" />" >
<bean:write  name="link" property="linkDesc" />
</html:link> 
 </td>
</tr>
</logic:iterate>


Thanks
Vinod

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: how to escape double quotes in html:link

Posted by Laurie Harper <la...@holoweb.net>.
Vinod Kumar wrote:
> Hi All,
>     I am trying to create a list of html links
> dynamiclly. I have a collection of links. My HyperLink
> class has one linkURL field and another linkDesc field
> (its a javabean). 
> 
> When I iterate thru these links, the double quotes are
> causing problem and i have tried every possible
> combination which I know( eg. adding a /" etc).
> 
> This line in below code is causing problem.
> <html:link action="<bean:write  name="link"
> property="linkURL" />" >
> 
> can anyone help me to fix this. Appreciate your help.
> 
> 
> <logic:iterate id="link" name="links" scope="session"
> type="com.abc.app.DTO.HyperLink">
> <tr>
> <td align="left" width="10"><img src="/img/s.gif"
> width="10" height="1" alt=""></td>
> <td align="left" valign="top" width="10"
> class="color003366"><span
> style="font-weight:bold">&raquo;</span></td>
> <td align="left" width="130">
> <html:link action="<bean:write  name="link"
> property="linkURL" />" >
> <bean:write  name="link" property="linkDesc" />
> </html:link> 
>  </td>
> </tr>
> </logic:iterate>

The problem is the way you're nesting JSP tags.Y ou can't use a JSP tag 
as the value of an attribute on another JSP tag; it's not valid syntax. 
Try one of these solutions instead:


JSTL:

<html:link action=${link.linkURL}"/>


JSP-only:

<html:link>
   <jsp:attribute name="action">
     <bean:write name="link" property="linkURL"/>
   </jsp:attribute>
</html:link>


There are other solutions as well, but one of those should get you going.

L.


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