2011-03-13 28 views
1

我有一个这样的网址:http://localhost:9001/view/shopindex/display?keyword=test&searchPostcode=Postcode,我将它放在使用HTML mailTo的新电子邮件正文中(我知道mailTo有更好的选项,但我仅限于此)。有效地我有这样的:MailTo中的转义&符号

<a href="mailto: ?subject=Look at this link&amp;body=http://localhost:9001/view/shopindex/display?keyword=test&amp;searchPostcode=Postcode"></a> 

的问题是,当我点击,我得到了新的电子邮件消息打开,我得到的只是在身体下面:

http://localhost:9001/view/shopindex/display?keyword=test

我想mailto正在将网页URL的查询字符串中的&符号识别为mailto URL的一部分。有没有办法逃避它?

谢谢!

Krt_Malta

回答

0

尝试编码URL-符号字符来代替:

http://localhost:9001/view/shopindex/display?keyword=test%26searchPostcode=Postcode 

它工作正常,我在Firefox中,你可以测试它here

+0

是的工作10倍:)我用我的控制器:m.put(“url”,URLEncoder.encode(url,“UTF-8”)); –