Solved

using javascript src tag in servlets for Apache

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mergeTwo  challenge 13 72
bunnyEars2 challenge 6 68
HashMap Vs TreeMap 12 49
Eclipse IDE - Cannot copy/paste from console output 8 67
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

758 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now