[jboss-user] [JBoss Portal] - XML Escaping resourceURLs

craigsdickson do-not-reply at jboss.com
Tue Jun 23 15:07:06 EDT 2009

I am attempting to deploy a very simple portlet onto JBoss Portal 2.7.2 (running on Mac OSX).

There is a requirement for the resulting HTML to be XHTML 1.0 Strict compliant.

Within the portlet I have a snippet of JavaScript that is designed to dynamically submit an asynchronous GET request using a JQuery library.

However, when using the <portlet:resourceURL/> tag to help create the URL to send the request to, I notice that the ampersands in the URL are not encoded properly and so validating the HTML is failing.

I have tried changing the use of the tag to <portlet:resourceURL escapeXml="true"/>.

I have also tried passing the javax.portlet.escapeXml system property on the JBoss command line by adding the following to my run.sh script:

JAVA_OPTS="-Djavax.portlet.escapeXml=true $JAVA_OPTS"

But nothing seems to make any difference.

And the worst part is, it appears that even the ampersands that I have been hand encoding are being converted back to unencoded ampersands. For example, in the JavaScript, I want to dynamically append one more request parameter to the URL that is generated by the <portlet:resourceURL/> tag like this:

var url = "<portlet:resourceURL/>&name=" + name;

However, the encoded ampersand before the name parameter gets simply converted to a single ampersand character when I view the source through Firebug etc. Like this:

var url = "/portal/auth/portal/default/Theme+Test/Quick+Extension+LookupWindow_90?action=b&cacheability=PAGE&name=" + name;

The actual JS code runs fine, but the page is failing the XHTML validation, which is a showstopper.

What am I missing?


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239537#4239537

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239537

More information about the jboss-user mailing list