[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

using javascript src tag in servlets for Apache

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
yousufbadar
Asked:
yousufbadar
1 Solution
 
rjackmanCommented:
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
 
objectsCommented:
does script.js exist?
0
 
shyamkumarreddyCommented:
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
 
SendohCommented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now