【问题标题】:UrlEncode the String [duplicate]UrlEncode字符串[重复]
【发布时间】:2011-08-02 23:06:32
【问题描述】:

可能重复:
How to URL-encode a String with JSTL?

我正在尝试对字符串进行 url 编码..

<c:out value="${filter.value.display}"/>

我试过这种方式

<%@ taglib prefix="encodeft" uri="http://java.net" %>

&lt;c:out value="${encodeft:URLEncoder.urlEncode(filter.value).display}"/&gt; 现在我得到了这个错误

The absolute uri: http://java.net cannot be resolved in either web.xml or the jar files deployed with this application

有什么建议吗??

【问题讨论】:

  • @BalusC,我已经更新了问题...

标签: java jstl


【解决方案1】:

也许

<c:out value="${filter.urlEncode(filter.value).display}"/>?

但我假设valuefilter 的属性,而urlEncode(String)filter 的方法,正如您的代码所建议的那样。

【讨论】:

  • 我试过这样做:- java.net" %> &lt;c:out value="${encodeft:URLEncoder.urlEncode(filter.value).display}"/&gt; 现在我得到了这个错误The absolute uri: http://java.net cannot be resolved in either web.xml or the jar files deployed with this application。我也更新了问题...
  • 所以你告诉 JSTL 有一个名为 encodeft:URLEncoder.urlEncode() 的函数,你在命名空间 http://java.net 中定义了它。你是怎么做到的?
  • 我不确定...我如何定义函数...使用它...可能我必须在某个地方定义这个函数??
  • @Raihan Jamal 你当然可以。不能只调用 EL 中的任意方法,只能调用 EL 知道的方法。
猜你喜欢
  • 2013-06-16
  • 2016-07-19
  • 2021-03-10
  • 1970-01-01
  • 1970-01-01
  • 2017-09-06
  • 2010-09-12
相关资源
最近更新 更多