使用 Java/ICEFaces 转义 url GET URL 中的参数

发布于 2024-08-13 03:35:03 字数 409 浏览 2 评论 0原文

我有一个带有 JSF/ICEFaces 的 JAVA 应用程序。我需要将参数从一个页面传递到另一个页面,因此我使用类似以下内容的内容:

<f:param name="eventName" value="#{item.event_name}" />

然后使用以下方式在构造函数中获取它:

eventName = request.getParameter("eventName");

虽然工作正常,除非提交的字符串中有“/”字符,但它无法正确解析。我相信我需要用 %2F 转义 '/' 参数,然后解析它。

两件事: 1-如何在 ICEFaces 或 JSF 中执行此操作 2-还有其他参数需要转义吗?

谢谢,

I have a JAVA with JSF/ICEFaces application. I need to pass parameters from one page to another so I user something like:

<f:param name="eventName" value="#{item.event_name}" />

And then get it in the constructor using:

eventName = request.getParameter("eventName");

While works fine unless there is a '/' character in the string submitted, it doesn't get parsed properly. I believe I need to escape the '/' parameter with %2F and then parse it back.

Two things:
1- How to do this in ICEFaces or JSF
2- Are there other parameter I have to escape?

Thanks,

Tam

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谜兔 2024-08-20 03:35:03
<h:outputLink value="http://google.com">click
    <f:param name="eventName" value="#{param.eventName}" />
</h:outputLink>

对我有用 - 浏览器负责 url 编码。

请注意,您可以使用 #{param.paramName} 直接在页面中获取请求参数

<h:outputLink value="http://google.com">click
    <f:param name="eventName" value="#{param.eventName}" />
</h:outputLink>

works for me - the browser takes care of url-encoding.

Note that you can get request parameters directly in your page, using #{param.paramName}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文