I havent found a better way than the tedious <%=request.getContextPath()%>

In your web.xml, you can specify other file extenstions that can get
compiled into a servlet

eg
        <!-- lets the servlet container know that anything with a .css extension is
to be compiled into a jsp -->
        <servlet-mapping>
                <servlet-name>jsp</servlet-name>
                <url-pattern>/*.css</url-pattern>
        </servlet-mapping>

        <!-- lets the servlet container know that anything with a .js extension is
to be compiled into a jsp -->
        <servlet-mapping>
                <servlet-name>jsp</servlet-name>
                <url-pattern>/*.js</url-pattern>
        </servlet-mapping>


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of SCOTT FARQUHAR
Sent: Friday, 16 March 2001 9:17 AM
To: Orion-Interest
Subject: offtopic: Path issues


When I have multiple web applications running on the one server - I'm having
problems referencing files in other directories.

eg - I can't use "/images/anImage.gif" because that references the document
root.  I can use "<%= request.getContextPath() %>/images/anImage.gif" ,but
that gets tedious.  Is there a better way to do it?

The other problem I have is referencing images from stylesheets and
javascript files.  Because they don't go through the JSP processor, I can't
use request.getContextPath() .  Without mapping .css and .js to the jsp
servlet - is there a way around this?

Also - with include files - are they always rooted from the web context

ie <@ include file="/includes/pageheader.jsp" %> —--> does this map to
http://myserver.com/mywebapp/includes/pageheader.jsp   ?

Does the same go for <jsp:include page="/includes/pageheader.jsp" />  ?

Thanks in advance for any help.

Scott




Reply via email to