Wiadomosc od Church Michael R z 2006-02-06 16:47 brzmiala:
The idea is that the content of the named division will be updated
every 10 seconds with some new content (which I am getting from a
remote servlet via the use of XMLHTTPRequest).
My problem is this. If I have two such portlets on the same page,
then I have created two divisions with the same name, and two copies
of each of the JavaScript functions. The name clashes can cause all
sorts of problems within the browser.
"Write" your JS scripts from the layout decorator, not from the protlets
themselves.Then it will appear in a page code once and will be available
to all the fragments.
Is there any way in which I can generate a unique number in my portlet
that I can then use to generate uniquely named divisions and functions
in the case where I have more than one instance of this portlet on the
portal page?
I suspect some clever use of attributes within the portlet session
could be useful here, but I'm not sure. Maybe all I need to do is set
up an APPLICATION_SCOPE integer attribute in the portlet session, and
simply increment its value by one every time doView() is called? Then
the value of that attribute could be exported to the JSP file and made
use of there?
Any thoughts?
You should read this thread:
http://www.nabble.com/Retrieving-a-portlet's-unique-instance-ID..-t970653.html#a2514746
--
pozdrawiam,
Jacek Wislicki
[EMAIL PROTECTED]
tel.: +48 502 408 444
gg: 2540358
skype: jacek_wislicki
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]