• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

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
0
mukundarao
Asked:
mukundarao
  • 2
  • 2
1 Solution
 
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
 
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now