Web.xml default mapping is breaking external CCS link.

R

Ron Brennan

Good morning.

I'm trying to have an instance of HomeServlet using an externally linked CSS
execute when a user enters www.myDomain.com. The HomeServlet does execute,
but the <servlet-mapping> below causes the CSS not to be applied. If I
replace the / in <url-pattern> with /homeServlet,
www.myDomain.com/homeServlet works fine.

stylesheet is in directory ROOT.

In HomeServlet:
out.println("<link rel=\"stylesheet\" type=\"text/css\"
href=\"/stylesheet.css\">");

In web.xml:
<servlet>
<servlet-name>homeServlet</servlet-name>
<servlet-class>HomeServlet</servlet-class>
</servlet>
....
<servlet-mapping>
<servlet-name>homeServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

Anyone have any ideas on why this isn't working, or how how to make it work?

Thanks,
Ron.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top