-
1. Re: Multiple instance of same portlet on same page
theute Jul 17, 2007 6:02 PM (in response to kumarkn)Use a different namespace for your HTML elements.
See the portlet spec. -
2. Re: Multiple instance of same portlet on same page
kumarkn Jul 17, 2007 6:11 PM (in response to kumarkn)Added to the above query.
Tried to fix the issue by looping through all the forms in the document and get the correct form name and apply the logic. It is working until i submit the form, once submitted the logic goes off. This issue is not happening always, its happening for frequent form submission.
Thanks. -
3. Re: Multiple instance of same portlet on same page
brownfielda Jul 18, 2007 8:23 AM (in response to kumarkn)Hadn't ever thought about this problem.
Digging through the portlet spec (as per Thomas' recommendation) found the solution in PLT 22.4. -
4. Re: Multiple instance of same portlet on same page
kumarkn Jul 18, 2007 11:44 AM (in response to kumarkn)Thanks for your reply.
I can able to fix the issue by giving the namespace tag. But i have few other problems with mulitple instance of same portlet on same page. I am invoking the javascript before the body tag
alert("Test");
...
On submit of this form again i am redirecting to the same JSP page in the portlets doView method but I am not getting the alert message on the submission of the form. When i do a refresh i am getting the alert. For random Submission the entire page is refreshed automatically and i am getting the alert.
Kindly help me to fix this issue. -
5. Re: Multiple instance of same portlet on same page
kumarkn Jul 18, 2007 11:48 AM (in response to kumarkn)Thanks for your reply.
I can able to fix the issue by giving the namespace tag. But i have few other problems with mulitple instance of same portlet on same page. I am invoking the javascript before the body tag<script language="JavaScript" > alert("Test"); </script> <body> ... </body>
On submit of this form again i am redirecting to the same JSP page in the portlets doView method but I am not getting the alert message on the submission of the form. When i do a refresh i am getting the alert. For random Submission the entire page is refreshed automatically and i am getting the alert.
Kindly help me to fix this issue. -
6. Re: Multiple instance of same portlet on same page
soshah Jul 18, 2007 12:00 PM (in response to kumarkn)Try this and see if its still random
<script language="JavaScript" > function callOnLoad() { alert("Test"); } </script> <body onload="javascript:callOnLoad();"> ... </body>
Basically making the code execute using DOM events.
Thanks -
7. Re: Multiple instance of same portlet on same page
kumarkn Jul 18, 2007 12:12 PM (in response to kumarkn)Tried with the Onload event but still its not working.
-
8. Re: Multiple instance of same portlet on same page
soshah Jul 18, 2007 12:16 PM (in response to kumarkn)Are you by any chance using the "Partial Refresh" feature of the Portal?
Reason I say that is with "Partial Refresh" only portions of your page a loaded and the Page is not fully refreshed.
If you page is being fully refreshed, the onload event on your body should be getting called
Thanks -
9. Re: Multiple instance of same portlet on same page
kumarkn Jul 18, 2007 12:40 PM (in response to kumarkn)No i am not using the partial refresh feature.
No one more thing is that the link tag for styles is also not working similar to the javascript. -
10. Re: Multiple instance of same portlet on same page
soshah Jul 18, 2007 1:00 PM (in response to kumarkn)And this onload javascript works just fine when only one instance of the portlet is placed on the page?
At this point you may have to do some javascript debugging on your browser.
The part is actually completely independent of what the portlets are doing on the page. The Portlets are just aggregated markup on the Page, so the
javascript should be like any other web application
Thanks -
11. Re: Multiple instance of same portlet on same page
kumarkn Jul 18, 2007 1:27 PM (in response to kumarkn)I did the following for the partial refresh
Log in as admin and added the Partial refresh property for that page but disabled the partial refresh by unchecking it.Then log in as the user and copied that particular page to my dashboard. Now everything is working fine. The problem is with the partial refresh, i have not enabled the feature but by default it is enabled so i disabled it as i mentioned. Is that the javascript and the link tags to style wont work for partial refresh(Multiple instance of same portlet on same page)?
Thank you very much for your kind help. -
12. Re: Multiple instance of same portlet on same page
soshah Jul 18, 2007 2:05 PM (in response to kumarkn)I don't think the onload javascript execution issue has anything to do with the fact you have instances of the same portlet on the same page.
This issue is more related to the way AJAX based Partial refresh works, and when that happens, only your pages DOM model is getting updated, but the actual Page is not getting refreshed (typical AJAX usecase).
Hence, the Page is not doing a complete refresh, the onLoad event is not fired, and your JavaScript is not executed.
I bet if you put the<Script language="JavaScript"> alert('Test'); </Script>
inside your Portlet markup, they will probably work even in "Partial Refresh" mode
Thanks -
13. Re: Multiple instance of same portlet on same page
brownfielda Jul 18, 2007 2:53 PM (in response to kumarkn)Possibly related: The portlet spec says something about disallowed HTML tags. I believe head and body were among them.
Is this relevant when using JSP?
Maybe dispatcher.include("myJSP.jsp") parses those tags out when returning control to the portlet. -
14. Re: Multiple instance of same portlet on same page
theute Jul 18, 2007 3:47 PM (in response to kumarkn)Well at the end there is a unique HTML page with a unique html, head and body tags. So in your portlet you mustn't produce those tags.