Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling external .js file from sevlet

Status
Not open for further replies.

birney29

Programmer
Oct 11, 2001
140
0
0
GB
im trying to use an external JavaScript file from a servlet. the javascript code works fine in the servlet so theres nothing wrong with that but when i try to use it externally, it gives an error saying no object. as though it cant find the .js file. the directory ect is fine. any ideas?

thanks

kenny

code :

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class UIConfig extends HttpServlet {

public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {

res.setContentType("text/html");
PrintWriter out = res.getWriter();

out.println(&quot;<html>&quot;);
out.println(&quot;<head>&quot;);
out.println(&quot;<title>&quot;);
out.println(&quot;UI config xml island test&quot;);
out.println(&quot;</title>&quot;);
out.println(&quot;<SCRIPT LANGUAGE=JavaScript SRC=UIConfig.js></script>&quot;);
// out.println(&quot;<script src=UIConfig.js></script>&quot;);
out.println(&quot;</head>&quot;);
out.println(&quot;<body onMouseMove=init() id=body>&quot;);
// out.println(&quot;<SCRIPT LANGUAGE='javascript'>&quot;);
// out.println(&quot; function init()&quot;);
// out.println(&quot; {&quot;);
// out.println(&quot; testXML.async = false;&quot;);
// out.println(&quot; testXML.load('../xml/ui.xml');&quot;);
// out.println(&quot;&quot;);
// out.println(&quot; formatUI(testXML);&quot;);
// out.println(&quot; }&quot;);
// out.println(&quot; function formatUI(testXML)&quot;);
// out.println(&quot; {&quot;);
// out.println(&quot; i = 0;&quot;);
// out.println(&quot; itemElement = testXML.documentElement.childNodes.item(i);&quot;);
// out.println(&quot; document.bgColor = itemElement.childNodes.item(0).childNodes.item(0).nodeValue;&quot;);
// out.println(&quot; document.fgColor = itemElement.childNodes.item(1).childNodes.item(0).nodeValue;&quot;);
// out.println(&quot; document.all.body.style.fontSize= itemElement.childNodes.item(2).childNodes.item(0).nodeValue;&quot;);
// out.println(&quot; } &quot;);
// out.println(&quot;</script>&quot;);
out.println(&quot;<p>Some Text that should be large<p>&quot;);
out.println(&quot;</body>&quot;);
out.println(&quot;<xml id=testXML></xml>&quot;);
out.println(&quot;</html>&quot;);
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top