• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Portlet body tag

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I am using JSR168 struts portlet usnig RAD.
In the portlets technology we should not use body tag.
But i need the functionality like,whenever the form loads it should call one javascript function ,we have a onload attribute in body tag,but we should not use body.
So,how to do that.
Actually,wht is the replacement of body tag in portlets.
Thanks a lot
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

According to JSR 168,"Portlets generating HTML fragments must not use the following tags: base, body,iframe, frame, frameset, head, html and title." But you can still have a body tag where you can add onload attribute in your original xxx.jsp(for instance,view.jsp).You can look the examples with the IBM portal application development redbook.

I have not experience on portal development.If I am worong,please correct me.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can think of couple of ways

1. Attach an event with the body tag using javascript like this

<script language="javascript">
if(body.attachEvent){
body.attachEvent("onload", func);
}

function func(){
//do some thing
}
</script>

This works in IE. Checkout how to do with other browsers if you need to support them.

2. The other option is to hava a simple javascript function at the end of the html content generated by your portlet

<div>
:
<!--content generated by portlet-->
:
</div>
<script language="javascript" defer>
function func(){
//do some thing here
}

//put a call to the above function here
func(); //or better yet, call this using window.setTimeout(...)

</script>
[ March 07, 2006: Message edited by: Asif Mohd ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic