tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robbert <robbert.ouweh...@gmail.com>
Subject Re: CSS not being used when a Servlet is involved
Date Fri, 27 Oct 2006 18:03:36 GMT

Christopher Schultz-2 wrote:
> 
> Robbert,
> 
>> (Yes, I have three locations for the statistics servlet. I don't know
>> where
>> to place it!)
> 
> See below.
> 
>> $CATALINA_HOME/webapps/ROOT/doc/o23/index.jsp (deze jsp file roept dus de
>> StatistiekServlet aan)
> 
> This should be fine.

Sorry about the Dutch, I forgot to edit that. The part in parenthesis says
that it's the JSP that calls the Servlet. The basic idea is this: the JSP
calls the Servlet and the Servlet fetches statistics and stores them.
Invoking it works fine, even without the package declaration.

> 
>> $CATALINA_HOME/webapps/ROOT/doc/o23/StatistiekServlet
> 
> This will not work: the servlet is not in the classpath (unless you've
> done something really weird).

Can't say I have, no.

> 
>> $CATALINA_HOME/webapps/ROOT/WEB-INF/classes/StatistiekServlet
> 
> This won't work: servlets basically do not work if they are not in
> packages.
Gotcha.

> 
>> $CATALINA_HOME/webapps/ROOT/WEB-INF/classes/o23/StatistiekServlet
> 
> This is the only one that will work, and your servlet must have a
> "package o23;" declaration at the top.

Makes sense, yes.

> 
> You'll need your web.xml to look like this:
> 
>> 	<servlet>
>> 	  <servlet-name>StatistiekServlet</servlet-name>
>> 	  <servlet-class>o23.StatistiekServlet</servlet-class>
>> 	</servlet>
> 

Done. Thanks for that. I'm not all that used when working with packages.

>> I always have this problem with Servlets. Is there any way to use CSS
>> (and
>> similar things...) with Servlets without too much trouble (like, changing
>> some configuration settings)?
> 
> Can you give an example of the URL being used when trying to load a CSS
> file? How about the servlet? You should make the changes noted above and
> tell us if it helped. Then, we can deal with the CSS issue.
> 
> -chris
> 

The URL used to call the index.jsp page is as follows:
http://localhost:8080/doc/o23/index.jsp

The CSS is loaded with the following tag:
<link href="style.css" rel="stylesheet" type="text/css" />

The Servlet is now placed in
$CATALINA_HOME/webapps/ROOT/WEB-INF/classes/o23/StatistiekServlet, and I'm
calling the Servlet with <jsp:include page="StatistiekServlet" flush="true"
/>

I hope that that's enough information and that I didn't mess up on posting.
This is my first time posting like this.


-- 
View this message in context: http://www.nabble.com/CSS-not-being-used-when-a-Servlet-is-involved-tf2521410.html#a7035402
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message