This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes How can you invoke a JavaScript within JSP code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How can you invoke a JavaScript within JSP code?" Watch "How can you invoke a JavaScript within JSP code?" New topic
Author

How can you invoke a JavaScript within JSP code?

Mahesh Mamani
Ranch Hand

Joined: Jun 25, 2001
Posts: 110
Hello,
Am trying to invoke a Javascript file from a JSP, but not successful.
Can u pls help me???
I am doing it in this way in the JSP code.
<head>
<script language="javascript" src = "pagename.js">
</script>
</head>

This doesn't invoke the Javascript at all.
What could be the reason and also the solution please.
Thanks in advance.

Mahesh
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
what you are doing here is making the javascript file availabe to the JSP code. Have you tried calling any of the functions in your .js fikle and it did not work?


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Are you really trying to run the Javascript on the server side? Javascript is primarily a client side technology.
Assuming you want it to run on the client side, I would start with a plain HTML page that does what you want, then try to create exactly that from JSP.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can you invoke a JavaScript within JSP code?