facebook

HowTo: include a servlet in a Web Project that executes

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #273359 Reply

    shafir
    Member

    i haven’t coded J2EE since 2000, things have certainly changed. i have a project that is mostly JSP’s, yet i need to have a servlet so that its Init() method can be used to instanciate several static variables that will be used throughout the JSPs.

    my simplest example is a Web Project where i’ve added a servlet (into /src). i see the entry in my web.xml….

    <web-app version=”2.5″
    xmlns=”http://java.sun.com/xml/ns/javaee&#8221;
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”&gt;
    <servlet>
    <description>yyyyyyyy</description>
    <display-name>xxxxxxx</display-name>
    <servlet-name>myServlet</servlet-name>
    <servlet-class>testweb.myServlet</servlet-class>
    </servlet>

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

    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>

    when i either run or debug the app, i get the default JSP (index.jsp) displayed, but my breakpoints in “myServlet” are never reached. i’m sure this is configurable, but i cannot find an example.

    can anyone point me to the right way to do this??? thanks in advance…..

    #273367 Reply

    shafir
    Member

    aha! i have found out that a FILTER on *.jsp is what i need.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: HowTo: include a servlet in a Web Project that executes

You must be logged in to post in the forum log in