File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Using java Script with jsp" Watch "Using java Script with jsp" New topic
Author

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 !!!
thxs
i will b waiting for reply
bye
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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="http://theurl.com/thefolder/theFile.js"></script>
That is what I got out of your post, but I am not even sure what you asked.
Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

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.
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using java Script with jsp