Sundeep, thanks for replying!
Let me explain the situation better. On load of the jsp page, a scriptlet is called which in turn calls thejavascript function. So, I cannot call the javascript function.
There is no problem when the page is first loaded but when the call goes to the servlet which, in turn, calls the previous JSP, I get an error which says that a particular javascript function is undefined.
Hope I have been able to make my doubt clear
Any help would be acknowledged!