portal:actionURL Spring MVC Portlet

你说的曾经没有我的故事 提交于 2019-12-24 02:33:37

问题


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

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

e.g.

<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

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

Many Thanks


回答1:


In a form action I use:

<portlet:actionURL var="send" escapeXml="false"/>



回答2:


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

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).

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>

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



来源:https://stackoverflow.com/questions/3968800/portalactionurl-spring-mvc-portlet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!