Invoking Java Script function from Servlet

Hi,
    Any body can help me ??
I have a java Script Function in one of the HTMLs and I want to invoke that function by passing a parameter value from the Servlet.
     Is there any soulution for that ?
Thanks in advance.
Mukunda Rao
mukundaraoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mukundaraoAuthor Commented:
my question is not to write a Java Script function from the Servlet I want to invoke a Java Script Function from the Servlet.

OK
0
pyxideCommented:
The simpliest way to pass a param from the server to a javascript function is ( if frames are allowed ) to use at least two frames :

<frameset>
<frame name=main_page src="main_page.html">
<frame name=param_page src="param_page.html">
</frameset>

first frame : a page with your javascript function.
main_page.html :

<script>

   // call the server.
  function callServlet()
  {
     parent.frames['param_page'].document.location = 'param_page?send_param=true';
  }

  function receiveParam(param)
  {
     alert(" param : " + param );
  }

</script>


second frame : a frame where you load a javascript
send by the servlet with the parameter in a javascript function.
param_page.html :

<script>

  parent.frames['main_page'].receiveParam(param);

</script>






0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sgomsCommented:
is the question still on?
0
pyxideCommented:
is mukundarao still on ?
0
mukundaraoAuthor Commented:
Hi Pyxide,
    Thanks your solution is Ok.
But can we make every thing in one Frame.

Mukunda Rao

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.