WebSphere Portal Server - Use of JavaScript in a Portlet

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > August 2005 > Use of JavaScript in a Portlet





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Use of JavaScript in a Portlet

2005-08-26, 6:02 pm

I am getting an error on my portlet after following the tutorial in the Rational Application Developer V6 and Portal Tools book.

In my JSP file, as advised, I wrote a function, but appended a tag to refer to the name space in the javascript like so:

function "portlet:namespace/"func_1(thisObj, thisEvent) {
document.forms['view"portlet:namespace/":form1'].submit();
return false;
}

This might be difficult to read. I have replaced the tag brackets around portlet:namespace with " because this forum strips out tags like that on posts.

I always get a javascript error when trying to display the portlet saying a '(' is expected on the line:

function "portlet:namespace/"func_1(thisObj, thisEvent) {

The portlet will never render either on the test environment. If I cut the javascript from my JSP page, it will render with no error. And if I cut the "portlet:namespace/", it renders without javascript error.

I have never gotten javascript to run properly. What is the right way to have it run on a portlet page? What is wrong with the code above?

I am using JSR 168.



Dennis te Lintelo

2005-08-29, 6:01 pm

You have to use the right tag...

function <portlet:encodeNamespace value="func_1"/>(thisObj, thisEvent) {
...your code...
}

Success!

Dennis te Lintelo
Portico Consultancy B.V.
The Netherlands
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com