tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Wolcott <wolc...@attglobal.net>
Subject TOMCAT, Servlets and Filters?
Date Fri, 18 Oct 2002 19:43:41 GMT
WINDOWS 2000 SVR, Apache 2.0, TOMCAT 4.1

In the primary conf/web.xml, the invoker <servlet> is defined, but the 
<servlet-mapping> is commented out.  In the /examples/WEB-INF/web.xml 
file, the <servlet-mapping> definition is given.  The servlets in this 
directory work.  In this same file, there is a bunch of other stuff that 
I'm not sure if I need or not.  Particularly the <filters> & 
<filter-mapping> directives.  Do I need them?  I tried my own servlet in 
/ROOT without them and it does not work, yet I've never seen them 
mentioned on any web pages or group messages about getting servlets to 
work.  (ROOT does work if I include them)

And as long as I'm imposing. . .    ;)

My JSP will not compile automatically.  If I let it fail, then go to the 
TOMCAT/work directory and compile it by hand it will work.  (I also had 
to copy my BEANS directory under the word lib to get it to compile.)  Do 
you have any hints on getting JASPER to work, or even how to figure out 
what the compile error is?   All I get in the error log is:

= = =

2002-10-18 14:00:06 StandardWrapperValve[jsp]: Servlet.service() for 
servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
    [javac] Compiling 1 source file

= = =

Finally:  (As IF!)

In the case of an APACHE/TOMCAT combination, does APACHE send the *.JSP 
to TOMCAT, then interpret the response before sending it back to the 
browser?  I currently have a few SSI in my JSP, and am using the 
<%@include file="TOP.html"%> JSP directives to get them in it, but that 
means I have to have copies of my include files in both APACHE's 
"htdocs" lib (for my other static pages) and TOMCAT's "ROOT" lib (for my 
JSP pages).  Can I change that to a normal HTTP INCLUDE?  (It didn't 
work when I was running under IIS and WebSphere.)

Thank you very much for your time.

DIR:
 
webapps
     '-  ROOT
         '- Welcome.jsp
         '- WEB-INF
              '- web.xml
              '- classes
                  '-  filters
                  '     '- ExampleFilter.class  (Supplied by Apache as 
part of the "/examples" app)
                  '-  WolcottSoft
                      '- AccessBean.class
                      '- URLChecker.class
                      '- servlets
                          '- HelloWorldServlet.class

WEB.XML:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
  <display-name>Default Web Application</display-name>
  <description>
     Main webpage for this site.
  </description>

  <welcome-file-list>
    <welcome-file>Welcome.jsp</welcome-file>
  </welcome-file-list>

  <!-- Define servlet-mapped and path-mapped ROOT 
filters                   -->
  <filter>
    <filter-name>Servlet Mapped Filter</filter-name>
    <filter-class>filters.ExampleFilter</filter-class>
    <init-param>
      <param-name>attribute</param-name>
      <param-value>filters.ExampleFilter.SERVLET_MAPPED</param-value>
    </init-param>
  </filter>
  <filter>
    <filter-name>Path Mapped Filter</filter-name>
    <filter-class>filters.ExampleFilter</filter-class>
    <init-param>
      <param-name>attribute</param-name>
      <param-value>filters.ExampleFilter.PATH_MAPPED</param-value>
    </init-param>
  </filter>

  <!-- Define filter mappings for the defined 
filters                       -->
  <filter-mapping>
      <filter-name>Servlet Mapped Filter</filter-name>
      <servlet-name>invoker</servlet-name>
  </filter-mapping>
  <filter-mapping>
      <filter-name>Path Mapped Filter</filter-name>
      <url-pattern>/servlet/*</url-pattern>
  </filter-mapping>

  <!-- Define servlets that are included in the ROOT 
application            -->

  <servlet>
    <servlet-name>HelloWorldServlet</servlet-name>
    <servlet-class>WolcottSoft.servlets.HelloWorldServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>HelloWorldServlet</servlet-name>
    <url-pattern>/servlet/HelloWorldServlet</url-pattern>
  </servlet-mapping>

  <!-- The mapping for the invoker servlet that is defined in the primary
       conf/WEB.XML 
file                                                    -->

  <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
  </servlet-mapping>

</web-app>

>http://www.geocities/os2dude  This is redirected to my dynamic IP
>



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message