No, that doesn't fix it.  It needs to be encoded.
It just needs to be encoded as "Dan\'s Test"
or even as "Dan\'s" but not as "Dan's".
The problem is that the brower converts '
back to a single quote early on in the game,
and then the single quote prematurely ends the string I
am trying to pass to the Javascript method, which
causes a Javascript exception.
Thanks,
Dan

> -----Original Message-----
> From: Yee, Richard K,,DMDCWEST [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 22, 2004 4:39 PM
> To: 'Struts Users Mailing List'
> Subject: RE: bean:write and apostrophes
> 
> 
> Dan,
> Try using the filter="false" attribute of the bean:write tag. 
> That will
> disable the encoding of characters that are sensitive to HTML.
> 
> 
> -Richard
> 
> -----Original Message-----
> From: Daniel Lipofsky [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, January 22, 2004 4:18 PM
> To: [EMAIL PROTECTED]
> Subject: bean:write and apostrophes
> 
> 
> If I use <bean:write ... filter=true>
> to write out the value "Dan's Test"  I get "Dan&#39;s".
> But this is giving me problems with Javascript.
> 
> THIS FAILS:
> <a href="javascript:alert('Dan&#39;s Test')">Dan&#39;s Test</a>
> 
> BUT THIS WORKS:
> <a href="javascript:alert('Dan\'s Test')">Dan&#39;s Test</a>
> 
> But I don't know how to get the second form.
> I can reverse the single quotes and double quotes
> in javascript - then it works for the test case above
> but fails for strings with double quotes.
> 
> Has anyone solved this problem?
> I am using IE 6.0 as my browser as struts 1.1.
> Here is the full test cases:
> 
> <% session.setAttribute("x","Dan's Test"); %>
> <% session.setAttribute("y","The \"other\" test"); %>
> <a href="javascript:alert('<bean:write name="x"/>')">x1</a><BR> <a
> href="javascript:alert('<bean:write name="y"/>')">y1</a><BR> <a
> href='javascript:alert("<bean:write name="x"/>")'>x2</a><BR> <a
> href='javascript:alert("<bean:write name="y"/>")'>y2</a><BR>
> 
> Thanks,
> Dan
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to