Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
shafir
Post subject: HowTo: include a servlet in a Web Project that executes  PostPosted: Jul 31, 2007 - 04:44 PM
Registered Member
Registered Member


Joined: Jul 11, 2007
Posts: 2

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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<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.....
 
 View user's profile Send private message  
Reply with quote Back to top
shafir
Post subject: RE: HowTo: include a servlet in a Web Project that executes  PostPosted: Jul 31, 2007 - 05:32 PM
Registered Member
Registered Member


Joined: Jul 11, 2007
Posts: 2

aha! i have found out that a FILTER on *.jsp is what i need.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits