portal:actionURL Spring MVC Portlet

2019-07-20 02:56发布

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

2条回答
淡お忘
2楼-- · 2019-07-20 03:30

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.

查看更多
Root(大扎)
3楼-- · 2019-07-20 03:38

In a form action I use:

<portlet:actionURL var="send" escapeXml="false"/>
查看更多
登录 后发表回答