Where to store my servlet ?

G

Gaurav

hi..

I have put my JSP page in the webapps\ROOT directory.
and then i have made a folder called as classes in the WEB-INF
subdirectory of ROOT directory
thus the hierarchy is like this

C:\Tomcat 5.5\webapps\ROOT\WEB-INF\classes

but when i access a servlet ResourceServlet.class file in the C:\Tomcat
5.5\webapps\ROOT\WEB-INF\classes , I CANT DO SO.

i access the servlet from the page called as demo.jsp stored in
C:\Tomcat 5.5\webapps\ROOT\ and my post method calls the path as
/servlet/ResourceServlet

kindly help me, as to what should I do ?

regards
Gaurav
 
T

Tor Iver Wilhelmsen

Gaurav said:
but when i access a servlet ResourceServlet.class file in the C:\Tomcat
5.5\webapps\ROOT\WEB-INF\classes , I CANT DO SO.

Not without setting up a servlet mapping in web.xml, no. Check the
web.xml file under ROOT\WEB-INF
/servlet/ResourceServlet

This is old servlet invocation syntax.
 
G

Gaurav

thnx tor... I got dat mapping right . n now its working..
but another problem has creeped up, when i call an instance of another
bean class from the servlet which is stored in the classes directory..
.... NOTHING happens !!
no error .. nothing.. but my job dosent get done !!!

??? STRANGE :-(
 
H

honeythegame

Where is your web.xml file and have you put in your servlet name and
mapping in it ??
 
G

Gaurav

my web.xml file is in the folder hierarchy C:\Tomcat
5.5\webapps\project\WEB-INF

i have described a servlet called as ResourcesServlet in the web.xml
file and also its mapping as ...

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


this servlet is stored in the classes directory with a hierarchy as

c:\Tomcat 5.5\webapps\project\WEB-INF\classes

in the same classes folder i have a bean class called as Bean.class


Now when i execute the servlet using a JSP page , the servlet gets
executed, but when it has to make an instance of a Bean class, it just
skips that part.

Do i need to specify beans also in the web.xml file ?

regrds

Gaurav
 
G

Gaurav

Another problem is that every time a make a change in my servlet, I
have to again stop and the restart the TOMCAT, to see the change..

y is dis ? dis is causing nighmares !!.. since i am in a development
stage
 
G

Gaurav

i just debugged the bean problem.. that beans deals with the databse.
and it seems that the database connection is not being made..

Probably database settings have to made in the web.xml file too...

nw, HOW to do that ?

gaurav
 
G

Gaurav

Hi everbody..

I got through this problem MYSELF !! ... I copied the database JDBC
file .JAR to the \Tomcat 5.5\common\lib

and it worked !!

regards !
 
?

=?iso-8859-1?q?Markus_B._Kr=FCger?=

Gaurav said:
Another problem is that every time a make a change in my servlet, I
have to again stop and the restart the TOMCAT, to see the change..

y is dis ? dis is causing nighmares !!.. since i am in a development
stage

There are several ways to make Tomcat reload a servlet without
restarting Tomcat. For instance, you can update the servlet's web.xml
or context XML file (requires that automatic redeployment is enabled),
or trigger a reload manually through the manager servlet. See
<http://jakarta.apache.org/tomcat/tomcat-5.5-doc/deployer-howto.html>
and <http://jakarta.apache.org/tomcat/tomcat-5.5-doc/manager-howto.html>
for more information.
 

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

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top