This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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
Posts: 20904
81
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
Boost this thread!