Re: error 404 with servlet not found...newbie question

marco_at_pivitsoft.com
Date: 08/05/04


Date: 4 Aug 2004 21:14:00 -0700

Bryce <spamtrap@berzerker-soft.com> wrote in message news:<f1atg0dn1nr4fegui60s3q8vafssa14dvi@4ax.com>...
> On 2 Aug 2004 10:57:28 -0700, marco@pivitsoft.com
> (marco@pivitsoft.com) wrote:
>
> >Good day,
> >
> >my issue is basically I have a very simple setup of a webappliction.
> >A couple of jsp pages and a couple of servlets.
> >
> >If I copy my classes into...
> >
> >C:\jakarta-tomcat-5.0.19\webapps\ROOT\WEB-INF\classes
> >
> >everything works...if I copy the same classes into
> >
> >C:\jakarta-tomcat-5.0.19\webapps\ROOT\test\WEB-INF\classes
> >
> >I get a 404 error. Now I know that my classes are working...and also
> >that my jsp pages are working.
> >
> >I have tried several things...here is what I placed in my server.xml:
> >
> >
> > <Context path="/DiscoverRealtor/"
> > docBase="DiscoverRealtor"
> > debug="1"
> > reloadable="true">
> > </Context>
> >
> >I have changed several times the CLASSPATH, and I have also added the
> >entire path into it...with no success...
>
> You shouldn't have to change the classpath. Tomcat will take care of
> that for you.
>
> What you aren't tell us is:
>
> 1. What does your web.xml look like?
> 2. What URL are you trying to access your servlets with.
>
> >if my classpath has the following:
> >
> >C:\jakarta-tomcat-5.0.19\webapps\ROOT\WEB-INF\classes
> >
> >everything works...if I put
> >
> >C:\jakarta-tomcat-5.0.19\webapps\ROOT\test\WEB-INF\classes
> >
> >it does not work...yet I know that the files are there and that they
> >work...
> >
> >Any help would be greatly appreciated!!
> >
> >
> >Marco

Thank you very much for all your help!!! I works perfectly!!!

Here is my setup that I have now...

Web.xml I left empty for now...I will add to it as I go along...
In the the Server.xml file I added

<Context path="webapps/test/"
                              docBase="test"
                              debug="1"
                              reloadable="true">
                     </Context>

Directory structure:

C:\jakarta-tomcat-5.0.19\webapps\test
                                     -css
                                     -images
                                     (all jsp files)
                                     ...
                                     -WEB-INF
                                          -classes
                                               (all my servlets)
                                          -lib
                                               (all my *.jar files)

The main issue that I had was to know what path to use when I called a
servlet from a jsp page / form...here is an example:

<form action="http://localhost/test/servlet/main.userlogin"
method="post">

and the next issue was to know how to forward(path) the jsp after the
"userlogin" and that was...
(java file)
      String address = "/logged.jsp";
      RequestDispatcher dispatcher =
request.getRequestDispatcher(address);
      dispatcher.forward(request, response);

So, thx again for all your help...

Marco

I got a fever, and the only prescription is more cowbell!



Relevant Pages

  • Re: asp.net 2.0 and Ajax
    ... The problem is probably that you do not have IIS setup as the "ASP.NET" ... It's pretty basic for jsp you need to setup tomcat to deal with calls to jsp ... Does any one have any ideas why Ajax doesn't work ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: plain JSP in a ASP.NET page
    ... I have a lot of jsp experience but am now moving to C# ... > However, what you could do, is setup IIS to forward JSP requests to your JSP ... > use the URL there's the 2k limit for one, security for another:<). ... > a solid transition and variable passing strategy. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: plain JSP in a ASP.NET page
    ... I have a lot of jsp experience but am now moving to C# ... However, what you could do, is setup IIS to forward JSP requests to your JSP ... use the URL there's the 2k limit for one, security for another:<). ... a solid transition and variable passing strategy. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: jsp and classpath
    ... >> I'm just started off learning a bit of jsp and jservlets. ... >> setup to run. ... Unable to compile class for JSP ...
    (comp.lang.java.programmer)
  • Re: J2ME or network programming or...what do you recommend?
    ... I started doing the servlets along with the JSP. ... Well depending on how dynamic you want the client to ... needed) to java server programs? ...
    (comp.lang.java.programmer)