File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to call JavaScript Function from jsp

 
Ganesan Kaliyaperumal
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have to call a javascript function which is not defined in the jsp file.

The function "cancelButton" is defined in "xyz.js", like...

I want to call this function from "abc.jsp".
How can i call?
What are the syntaxs to call that function.

Regards
Ganesan K
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm assuming that you're not trying to call a Javascript function from JSP code. This can't be done.

Moving to the HTML/Javascript forum where Javascript issues are covered.
 
Dom Lassy
Ranch Hand
Posts: 181
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the head of the jsp, add this:
<script language="javascript" type="text/javascript" src="xyz.js"></script>

Then you can just call the function like it was included in the jsp.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Dom Lassy:

Then you can just call the function like it was included in the jsp.


"Like" it was included? That does include it. No "like" about it.
[ August 02, 2006: Message edited by: Bear Bibeault ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic