Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onload not working with jsp

 
nishad km
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a jsp file in which i m calling a javascript in onload event, that java script method contain only one alert. but it doesnt work.
i called the same javascript fuction on click event of a button then the fuction get called.

i saved the same jsp file as html file then the every thing is ok , i m able to call the javascript function in onload event.

can any one say y one javacript method (onload)is not working in jsp and working in html
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any more details(sample source code) will be greatly appreciated.

Regardless, any javascript code you have in your JSP is never executed by the Container. JSP is executed server side, and Javascript is executed client side, in the browser. So there should be no difference between the HTML or JSP, which I am assuming is producing the same/similar HTML, file containing the javascript.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic