Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onload for JSP

 
lijun wang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a onload()(javascript) method when I load JSP file?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean this:

<BODY onload='alert("zut!")'>
 
lijun wang
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using JSF, so there is no body tag, but f:view instead
Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64852
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the HTML/Javascript forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64852
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by lijun wang:
I'm using JSF, so there is no body tag, but f:view instead


If the f:view tag doesn't allow you to specify an onload handler (did you check?), you can do so in the header section of your page like so:

 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by lijun wang:
I'm using JSF, so there is no body tag, but f:view instead
Thanks


In fact, there is still a body tag. f:view doesn't replace or supercede it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64852
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeff Albertson:

In fact, there is still a body tag. f:view doesn't replace or supercede it.


In that case, I suspect the issue is that the OP is creating malformed HTML.
 
Yuriy Fuksenko
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, if you have more than one user contributing to the page (i.e. the page composed from a different pieces that created by different people) you might want to add your onload functionality to the one that already exists.You can put this code anywhere inside body tag
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic