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