Where to store my servlet ?

Discussion in 'Java' started by Gaurav, Apr 26, 2005.

  1. Gaurav

    Gaurav Guest

    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
     
    Gaurav, Apr 26, 2005
    #1
    1. Advertising

  2. "Gaurav" <> writes:

    > 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.
     
    Tor Iver Wilhelmsen, Apr 26, 2005
    #2
    1. Advertising

  3. Gaurav

    Gaurav Guest

    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 :-(
     
    Gaurav, Apr 26, 2005
    #3
  4. Gaurav

    honeythegame Guest

    Where is your web.xml file and have you put in your servlet name and
    mapping in it ??
     
    honeythegame, Apr 26, 2005
    #4
  5. Gaurav

    Gaurav Guest

    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
     
    Gaurav, Apr 27, 2005
    #5
  6. Gaurav

    Gaurav Guest

    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
     
    Gaurav, Apr 27, 2005
    #6
  7. Gaurav

    Gaurav Guest

    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
     
    Gaurav, Apr 27, 2005
    #7
  8. Gaurav

    Gaurav Guest

    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 !
     
    Gaurav, Apr 27, 2005
    #8
  9. "Gaurav" <> writes:

    > 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.

    --
    ,------------------- Markus Bjartveit Kr├╝ger ---------------------.
    ' `
    ` E-mail: WWW: http://www.pvv.org/~markusk/ '
    )-------------------------------------------------------------------(
     
    =?iso-8859-1?q?Markus_B._Kr=FCger?=, Apr 27, 2005
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UnVkeQ==?=

    to store or not to store an image

    =?Utf-8?B?UnVkeQ==?=, Mar 29, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    649
    =?Utf-8?B?UnVkeQ==?=
    Mar 30, 2005
  2. circuit_breaker
    Replies:
    2
    Views:
    2,022
    Jack Jia
    Apr 4, 2004
  3. mj
    Replies:
    2
    Views:
    386
    Will Hartung
    Aug 25, 2004
  4. Sachin
    Replies:
    2
    Views:
    454
    Sachin
    Sep 22, 2006
  5. Nike

    Image store using Servlet

    Nike, Nov 6, 2006, in forum: Java
    Replies:
    1
    Views:
    482
    Manish Pandit
    Nov 6, 2006
Loading...

Share This Page