在超链接文本中显示特殊字符
我在 Java 类中使用了 HTML,并且在一种情况下我使用了 username
。用户名是一个动态获取值的变量。在一种情况下,它的值是“rg@bg”,但这里我获取的是它在 jsp 中定向到的 URL,而不是名称。如何确保用户名的值按原样出现在显示页面上。 我试过“@”+用户名。没用
I have used HTML in my Java class and in one case I have used <a href="...">username</a>
. Username is a variable that gets values dynamically. In one case its value is 'rg@bg' but here instead of the name I'm getting the URL to which it is directed in my jsp. How do I ensure that the value of username comes on the display page as it is.
I have tried "@"+username. Didn't work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您没有安装 Greasemonkey 来自动将电子邮件模式转换为链接吗?
You don't have greasemonkey installed which automatically converts email patterns into links?
我不确定我是否理解你的问题,但这是一个猜测。
我怀疑你实际打印错误。如果变量名为
username
并且打印“username”而不是username
的内容,那么您似乎需要执行类似的操作,而不是
在 jsp 中,您也可以简单地编写
If问题涉及 html 实体的处理,您可能会发现以下有趣的内容:
http://www .rgagnon.com/javadetails/java-0306.html
I'm not sure I understand your problem, but here is a guess.
I suspect you do the actual print wrong. If the variable is called
username
and "username" is printed instead of the content ofusername
it seems you need to do something likeinstead of
In jsp you could also simply write
If the problem concerns treatment of html-entities you may find the following interesting:
http://www.rgagnon.com/javadetails/java-0306.html