问题
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>&p_p_lifecycle=1&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&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