Solved

using javascript src tag in servlets for Apache

Posted on 2001-07-31
4
263 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why my table column Id is not passed to java object? 4 46
Convert from a json string array to a Java object 3 65
Selenium docs api java index 3 69
junit example issue 2 28
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

730 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