Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to run java script in a jsp before processing a method in scriplet

 
hemanth suram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a jsp. I need to run a java script in body on load. Here in my jsp i have to do a lot of process by calling a method in a bean. The problem is, my script is running after completing the java process. But, i need run this process before calling this method. How can i do this?
 
Jagdish Hatagale
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
call the java script method in form tag with onload action so that java script will call at page loading.


Regards
jagdish Hatgale
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That still won't work, since the HTML page is only sent to the client after the code on the page has finished.

You will need to move the method call outside your JSP page to a servlet or another JSP page. Your onload script should then call this servlet / JSP page (through AJAX).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic