This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Using java Script with jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Using java Script with jsp" Watch "Using java Script with jsp" New topic

Using java Script with jsp

perry arora
Ranch Hand

Joined: Sep 18, 2003
Posts: 35
hi friends

What i am doing is that i am diaplying an html content from a jsp,
that content has a call to a java script function which is defined in some another java script file which i am including in the html code.

know when i run the html code . with out includinh it in a jsp file it if running fine
But when i try it and want my jsp to give the same result wheni run it ina browser it not working
I tried to debug and found that the java script function which i am trying to call , is not being properly called!
The reason which i thing may be is that when i was using the plain html file to run , then the java script file that has the defination of that fucntion was there in the same folder,
But in case of jsp .. i dont know where we put that javascript file so that it is visible to that jsp...
i know that we have a location to place all the class files which the jsp is using but do we place the java script file in the same place ,
Hey can any one tell me where we need to put the file...
or any one who is expert in javascript can help me !!!
i will b waiting for reply
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
so you are inclusing the JavaScript file?
<script src="theFile.js"></script>
If you are, you can hard code the link to the file
<script src=""></script>
That is what I got out of your post, but I am not even sure what you asked.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60802

The fact that you are using a JSP is moot. What matters is what is sent to the browser, and what the URL you are using is. Your external resources will be releative to the URL.
Best bet is to perform a View Source to check that what is being sent to the browser is what you expect, and that the href's of your external resources are correct for the accessing URL.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Using java Script with jsp
Similar Threads
Can't include .js file on jsp page controlled by front controller servlet
JSP Not able to Identify the JS, CSS file path
how to load HTML in DIV
Trying to evaluate lt%= fieldName.toString() gt from with an onblir
onload not working with jsp