portal:actionURL Spring MVC Portlet [英] portal:actionURL Spring MVC Portlet

查看:129
本文介绍了portal:actionURL Spring MVC Portlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码创建一个actionUrl

I am trying to create a actionUrl using the following code

<portlet:actionURL var="actionUrl"><portlet:param name='action' value='viewModules' /></portlet:actionURL>

并将其映射到弹簧控制器

and map that onto a spring controller

但是,由于生成的URL的&"号已被编码,控制器仍未响应

However the controller does not respond as the generated url's ampersands are encoded

例如

<snip>&amp;p_p_lifecycle=1&amp;p_p_state=normal&amp;p_p_mode=view&amp;p_p_col_id=column-1&amp;p_p_col_count=2</snip>

如果我取消编码并将其粘贴到浏览器中,那么它将起作用

If I unencode and paste into the browser this works

我添加了 portlet.url.escape.xml = false 到portal-ext.properties但没有可用的

I have added portlet.url.escape.xml=false to portal-ext.properties but to no available

能不能给我指出正确的方向

Could any please point me in the right direction

非常感谢

推荐答案

我刚刚从同事那里得到了关于此问题的独家报道...

I just got the scoop on this issue from a colleague...

显然,Portlet 2.0更改了URL的状态,并声明默认情况下必须对其进行转义. (以前没有规则,而且似乎有几个门户网站是在不转义的情况下实现它们的.)转义的URL在大多数情况下都可以正常工作……但并非在每种情况下(例如,在JavaScript中使用时)都可以正常工作.

Apparently Portlet 2.0 changed the status quo for URLs and declared they must be escaped by default. (Previously there was no rule, and it seems several portals implemented them unescaped.) Escaped URLs work just fine in the majority of cases... but not in every case (e.g. when used in JavaScript).

对于那些情况,标记的2.0版本提供了escapeXml="false"属性.这是一个示例:

For those cases the 2.0 version of the tags offers the escapeXml="false" attribute. Here's an example:

<portlet:renderURL var="enterAlertUrl" escapeXml="false">
    <portlet:param name="action" value="enterAlert"/>
    <portlet:param name="studentId" value="STUDENTID"/>
    <portlet:param name="courseId" value="COURSEID"/>
</portlet:renderURL>

此renderURL将为您提供一个URL字符串, 参数之间没有URL编码的与号.

This renderURL will give you a URL string without URL-encoded ampersands between parameters.

这篇关于portal:actionURL Spring MVC Portlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆