this.getContextPath() + "/script/utility.js"
Dynamically adding the context path this way guarantees that no matter what context path your webapp is deployed in, the path to your file will always be valid.
See: http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/http/HttpServletRequest.html#getContextPath()
Jake
At 07:39 PM 12/29/2003 +0800, you wrote:
Howdy,
I am developing a web app using win2k pro + Tomcat
In a servlet , the following code works ( file /script/utility.js can be get by IE)
sb.append ("<html>\n");
sb.append ("<head>\n");
sb.append ( getContentTypeMeta(_req) );
sb.append ("<script language=javascript1.2 src=\"/script/utility.js\"></script>\n");
^ but when the preceding slash is deleted, IE can not get the js fileļ¼
sb.append ("<html>\n");
sb.append ("<head>\n");
sb.append ( getContentTypeMeta(_req) );
sb.append ("<script language=javascript1.2 src=\"script/utility.js\"></script>\n");
^ no / here
BTW, both are OK under TC 4.0.1.
Because the web app will be deployed in another servlet container which only
recognize the first format , I want to using the format with preceding "/ " , how should I do ?
( better not to use 4.0.1 :)
TIA
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]