Solved

using javascript src tag in servlets for Apache

Posted on 2001-07-31
4
259 Views
Last Modified: 2013-11-24
i have been trying to call javascript using javascript src tag (<javascript src="script.js">) in my servlet which generates the html page(by using printwriter.println(""); statement) but the generated page fails to call the source.
 is it that the generated page does not have control on the js file.
please help me out with some solution.

thanks..
0
Comment
Question by:yousufbadar
4 Comments
 
LVL 3

Accepted Solution

by:
rjackman earned 100 total points
ID: 6337179
hi
try this out

out.println("<script language="JavaScript" type="text/javascript" src="/home/src/script.js"></script>
");

where /home/src/script.js is the full path of the file
where out is the object of PrintWriter
cheers
RJ
0
 
LVL 92

Expert Comment

by:objects
ID: 6337180
does script.js exist?
0
 
LVL 3

Expert Comment

by:shyamkumarreddy
ID: 6337234
Hey YOusurfbadar

Please place your js file in your servlet or jsp file path.
Okay
this will also work

<script src="file.js"></script>


Shyam


0
 
LVL 3

Expert Comment

by:Sendoh
ID: 6339206
hi !
as what the others said...
the generated page does have control of *.js files...
or else the jsp's with *.js wont work either...
so the problem here is the existances of "script.js" and the way u code the servlet...:P

hope it give u an idea to solve ur problem...:)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
object oriented programming comparison 5 71
more than one jdk and one jre 1 41
factorial example 4 39
Convert from a json string array to a Java object 3 32
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question