Portlet URL Issues


Recently, I had to port a few portlets from WebSphere Portal 6.1 to WebLogic Portal 10g. Things mostly went smoothly. Except for portlet and resource URLs.

Weblogic portal adds URL parameters to portlet and resources URLs. For example:

http://localhost:7001/AjaxWeb/ProductSearch.portlet?_nfpb=true&_st=&_windowLabel=ProductSearch_portlet…

These parameters caused unexpected problems.

POST Only

For one thing, these URLs can not be used with a form that makes a GET request.

<form method="GET" action="&lt;portlet:actionURL/&gt;"> 

<input type="firstName"/> 
  ... 

</form>

If you submit this form, the input elements will overwrite the URL parameters that are in the action URL. Things will work out badly from that point on.

Lesson learned, you can only make POST requests from a form.

Watch Out for Resource URLs

By default, the <portlet:resourceURL> tag escapes XML in the URL. That means, all “&” parameter separators in the URL will be replaced by “&amp;”. If you send a request to that URL, the serveResource() method will not be invoked. You must set escapeXml attribute to false. For example:

var url = "<portlet:resourceURL escapeXml="false"/>&searchText=" + txt;

None of these are issues in WebSphere Portal since the URLs do not contain any parameters.

  1. No comments yet.
(will not be published)

*