• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

onload for JSP

 
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?
 
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
 
Marshal
Posts: 67299
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the HTML/Javascript forum.
 
Bear Bibeault
Marshal
Posts: 67299
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Marshal
Posts: 67299
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
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
 
We find this kind of rampant individuality very disturbing. But not this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!