Re: First Servlet 404 error

2003-09-02 Thread Jim Si
Then I got HTTP Status 500 error

description The server encountered an internal error () that prevented it from
fulfilling this request.

exception

java.lang.IllegalArgumentException: Path welcome.jsp does not start with a /
character
at
org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:1179)




Stuart MacPherson wrote:

 Tomcat can usually find JSPs very easily.  Is welcome.jsp also in
 CATALINA_HOME/webapps/onjava/ ?  Try the following:

 private String target = welcome.jsp;

 If 'onjava' is your namespace then this might work.

 -Original Message-
 From: Jim Si [mailto:[EMAIL PROTECTED]
 Sent: 29 August 2003 19:04
 To: Tomcat Users List
 Cc: Stuart MacPherson
 Subject: Re: First Servlet 404 error

 Thank you Stuart for your great help.

 HellowWorld servlet works! But I still have one problem.

 I got login.jsp in the webapps\onjava directory.  It has
 form name=loginForm method=POST action=servlet/com.onjava.login

 In login.java, it has
  private String target = /welcome.jsp;
 ...
   // Forward the request to the target named
   ServletContext context = getServletContext();
   RequestDispatcher dispatcher = context.getRequestDispatcher(target);
   dispatcher.forward(request, response);

 In welcome.jsp, it has very simple return statement.
bWelcome : %= request.getAttribute(USER)

 In webapps\onjava\Web-inf\web.xml, I have
 servlet
 servlet-namelogin/servlet-name
 servlet-classcom.onjava.login/servlet-class
 /servlet

 servlet-mapping
 servlet-namelogin/servlet-name
 url-pattern/servlet/url-pattern
 /servlet-mapping

 In a browser, I use http://localhost:8080/onjava/login.jsp and I got the
 login
 screen, then click on submit button.  I got the following error.

 HTTP Status 404 - /welcome.jsp
 description The requested resource (/welcome.jsp) is not available.

 Look like it runs the login class, how do I correct this problem?  Thank
 you.

  Also, make sure your HelloWorld servlet is mapped-in in your webapps
  deployment descriptor.  By the way, the folder should be called WEB-INF
 not
  web-inf.
 

 Windows somehow change WEB-INF to Web-inf automatically.  I could not use
 WEB-INF.

 Jim

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: First Servlet 404 error

2003-09-02 Thread Shapira, Yoav

Howdy,
Read the spec... When asking for a RequestDispatcher the resource path
you're requesting must start with a / indicating its relativity to the
context docBase.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Jim Si [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 02, 2003 11:11 AM
To: Tomcat Users List; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: First Servlet 404 error

Then I got HTTP Status 500 error

description The server encountered an internal error () that prevented
it
from
fulfilling this request.

exception

java.lang.IllegalArgumentException: Path welcome.jsp does not start
with a
/
character
at
org.apache.catalina.core.ApplicationContext.getRequestDispatcher(Applic
atio
nContext.java:1179)




Stuart MacPherson wrote:

 Tomcat can usually find JSPs very easily.  Is welcome.jsp also in
 CATALINA_HOME/webapps/onjava/ ?  Try the following:

 private String target = welcome.jsp;

 If 'onjava' is your namespace then this might work.

 -Original Message-
 From: Jim Si [mailto:[EMAIL PROTECTED]
 Sent: 29 August 2003 19:04
 To: Tomcat Users List
 Cc: Stuart MacPherson
 Subject: Re: First Servlet 404 error

 Thank you Stuart for your great help.

 HellowWorld servlet works! But I still have one problem.

 I got login.jsp in the webapps\onjava directory.  It has
 form name=loginForm method=POST
action=servlet/com.onjava.login

 In login.java, it has
  private String target = /welcome.jsp;
 ...
   // Forward the request to the target named
   ServletContext context = getServletContext();
   RequestDispatcher dispatcher =
context.getRequestDispatcher(target);
   dispatcher.forward(request, response);

 In welcome.jsp, it has very simple return statement.
bWelcome : %= request.getAttribute(USER)

 In webapps\onjava\Web-inf\web.xml, I have
 servlet
 servlet-namelogin/servlet-name
 servlet-classcom.onjava.login/servlet-class
 /servlet

 servlet-mapping
 servlet-namelogin/servlet-name
 url-pattern/servlet/url-pattern
 /servlet-mapping

 In a browser, I use http://localhost:8080/onjava/login.jsp and I got
the
 login
 screen, then click on submit button.  I got the following error.

 HTTP Status 404 - /welcome.jsp
 description The requested resource (/welcome.jsp) is not available.

 Look like it runs the login class, how do I correct this problem?
Thank
 you.

  Also, make sure your HelloWorld servlet is mapped-in in your
webapps
  deployment descriptor.  By the way, the folder should be called
WEB-INF
 not
  web-inf.
 

 Windows somehow change WEB-INF to Web-inf automatically.  I could not
use
 WEB-INF.

 Jim

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: First Servlet 404 error

2003-08-30 Thread Stuart MacPherson
Tomcat can usually find JSPs very easily.  Is welcome.jsp also in
CATALINA_HOME/webapps/onjava/ ?  Try the following:

private String target = welcome.jsp;

If 'onjava' is your namespace then this might work.



-Original Message-
From: Jim Si [mailto:[EMAIL PROTECTED] 
Sent: 29 August 2003 19:04
To: Tomcat Users List
Cc: Stuart MacPherson
Subject: Re: First Servlet 404 error

Thank you Stuart for your great help.

HellowWorld servlet works! But I still have one problem.

I got login.jsp in the webapps\onjava directory.  It has
form name=loginForm method=POST action=servlet/com.onjava.login

In login.java, it has
 private String target = /welcome.jsp;
...
  // Forward the request to the target named
  ServletContext context = getServletContext();
  RequestDispatcher dispatcher = context.getRequestDispatcher(target);
  dispatcher.forward(request, response);

In welcome.jsp, it has very simple return statement.
   bWelcome : %= request.getAttribute(USER)

In webapps\onjava\Web-inf\web.xml, I have
servlet
servlet-namelogin/servlet-name
servlet-classcom.onjava.login/servlet-class
/servlet

servlet-mapping
servlet-namelogin/servlet-name
url-pattern/servlet/url-pattern
/servlet-mapping

In a browser, I use http://localhost:8080/onjava/login.jsp and I got the
login
screen, then click on submit button.  I got the following error.

HTTP Status 404 - /welcome.jsp
description The requested resource (/welcome.jsp) is not available.

Look like it runs the login class, how do I correct this problem?  Thank
you.

 Also, make sure your HelloWorld servlet is mapped-in in your webapps
 deployment descriptor.  By the way, the folder should be called WEB-INF
not
 web-inf.


Windows somehow change WEB-INF to Web-inf automatically.  I could not use
WEB-INF.

Jim


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: First Servlet 404 error

2003-08-30 Thread Jeff Tulley
One note:  Windows only makes it look like you have the name Web-inf. 
Do a Properties on it (right click, choose properties), and you might
see it is actualy WEB-INF.  So, you might be ok.  Windows doesn't
change the folder, it just displays it innacurately.

- Jeff Tulley

 [EMAIL PROTECTED] 8/29/03 5:36:36 PM 
Tomcat can usually find JSPs very easily.  Is welcome.jsp also in
CATALINA_HOME/webapps/onjava/ ?  Try the following:

private String target = welcome.jsp;

If 'onjava' is your namespace then this might work.



-Original Message-
From: Jim Si [mailto:[EMAIL PROTECTED] 
Sent: 29 August 2003 19:04
To: Tomcat Users List
Cc: Stuart MacPherson
Subject: Re: First Servlet 404 error

snip /

Windows somehow change WEB-INF to Web-inf automatically.  I could not
use
WEB-INF.

Jim


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: First Servlet 404 error

2003-08-30 Thread Jeff Tulley
One more nit-pick.  As I said earlier, use /servlet/login instead of
servlet/com.onjava.login.  Then you can turn off the InvokerServlet,
which could be used for security exploits.  Your current mapping (in
your last email) had 

servlet-mapping
servlet-namelogin/servlet-name
url-pattern/servlet/url-pattern
/servlet-mapping

What exactly are you trying to achieve here?  This is simply in error. 
Do you really want /servlet to map to your login servlet each and
every time?  You would not be able to have any other servlets in your
application.  Perhaps what you are trying to do is have all
unauthenticated requests to go to the login servlet?  To do this, use a
security-constraint, login-config, and security-role instead. 
(See Tomcat's admin and manager applications for an example).  Then you
can map all requests into your web app (the ones you want secured
anyway) to your login.jsp that you are working on.

I'm not sure if that will fix your welcome.jsp problem; probably not. 
Try removing the slash like Stuart said, though it should work either
way if welcome.jsp is in webapps/onjava/

- Jeff Tulley

 [EMAIL PROTECTED] 8/29/03 5:36:36 PM 
Tomcat can usually find JSPs very easily.  Is welcome.jsp also in
CATALINA_HOME/webapps/onjava/ ?  Try the following:

private String target = welcome.jsp;

If 'onjava' is your namespace then this might work.



-Original Message-
From: Jim Si [mailto:[EMAIL PROTECTED] 
Sent: 29 August 2003 19:04
To: Tomcat Users List
Cc: Stuart MacPherson
Subject: Re: First Servlet 404 error

Thank you Stuart for your great help.

HellowWorld servlet works! But I still have one problem.

I got login.jsp in the webapps\onjava directory.  It has
form name=loginForm method=POST
action=servlet/com.onjava.login

In login.java, it has
 private String target = /welcome.jsp;
...
  // Forward the request to the target named
  ServletContext context = getServletContext();
  RequestDispatcher dispatcher = context.getRequestDispatcher(target);
  dispatcher.forward(request, response);

In welcome.jsp, it has very simple return statement.
   bWelcome : %= request.getAttribute(USER)

In webapps\onjava\Web-inf\web.xml, I have
servlet
servlet-namelogin/servlet-name
servlet-classcom.onjava.login/servlet-class
/servlet

servlet-mapping
servlet-namelogin/servlet-name
url-pattern/servlet/url-pattern
/servlet-mapping

In a browser, I use http://localhost:8080/onjava/login.jsp and I got
the
login
screen, then click on submit button.  I got the following error.

HTTP Status 404 - /welcome.jsp
description The requested resource (/welcome.jsp) is not available.

Look like it runs the login class, how do I correct this problem? 
Thank
you.

 Also, make sure your HelloWorld servlet is mapped-in in your webapps
 deployment descriptor.  By the way, the folder should be called
WEB-INF
not
 web-inf.


Windows somehow change WEB-INF to Web-inf automatically.  I could not
use
WEB-INF.

Jim


-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 




-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: First Servlet 404 error

2003-08-29 Thread Jim Si
What is the common practise?

Jeff Tulley wrote:

 It looks like you want your form action to actually be servlet/login, or
 maybe /onjava/servlet/login  (you can use
 %=request.getContextPath()%/servlet/login in the jsp if you don't want
 to hardcode your context name).
 You have set up the mapping of /servlet/login in your web.xml, not
 /servlet/com.onjava.login  That name is only known internally since it
 does not have its own servlet-mapping.

 Jeff Tulley  ([EMAIL PROTECTED])
 (801)861-5322
 Novell, Inc., The Leading Provider of Net Business Solutions
 http://www.novell.com

  [EMAIL PROTECTED] 8/28/03 2:36:33 PM 
 It is difficult to get my first servlet working. I got HTTP Status 404
 -
 /onjava/servlet/com.onjava.login error.  Maybe something I did not get
 it right.
 Here are the things I have.

 Tomcat 4.1.27

 In conf/server.xml, I added the following line.
   Context className=org.apache.catalina.core.StandardContext
 crossContext=true reloadable=true
 mapperClass=org.apache.catalina.core.StandardContextMapper
 useNaming=true
 debug=0 swallowOutput=false privileged=false displayName=On Java
 Example
 wrapperClass=org.apache.catalina.core.StandardWrapper
 docBase=onjava
 cookies=true path=/onjava cachingAllowed=true
 charsetMapperClass=org.apache.catalina.util.CharsetMapper
 /Context

 In conf/web.xml, I uncomment the invoker mapping, i.e.
 servlet-mapping
 servlet-nameinvoker/servlet-name
 url-pattern/servlet/*/url-pattern
 /servlet-mapping

 The I have login.jsp and welcome.jsp file under webapps/onjava
 directory.
 In login.jsp, I have the following code
  form name=loginForm method=post
 action=servlet/com.onjava.login
 ..
  /form

 I have login.java file with package statement on top.
 package com.onjava;
 I compiled the code and move the login.class file into
 webapps/onjava/Web-inf/classes/com/onjava directory.

 In webapps/Web-inf/web.xml file,  I have the following line of code.
   ?xml version=1.0 encoding=ISO-8859-1 ?
   !DOCTYPE web-app (View Source for full doctype...)
 - web-app
 - servlet
   servlet-namelogin/servlet-name
   servlet-classcom.onjava.login/servlet-class
   /servlet
 - servlet-mapping
   servlet-namelogin/servlet-name
   url-pattern/servlet/login/url-pattern
   /servlet-mapping
   /web-app

 I am able to get login.jsp by using
 http://localhost:8080/onjava/login.jsp. But
 when I submit it I got the HTTP status 404 -
 /onjava/servlet/com.onjava.login
 error.

 Anything I did wrong?

 Jim

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: First Servlet 404 error

2003-08-29 Thread Stuart MacPherson


You didn't mention anything about a HelloWorld Servlet before.  You have not
configured the context of your webapp, and tomcat does not even know it
exists.  Create a file called onjava.xml and place it in your webapps
directory.  This should contain something along the lines of:

context path=onjava docBase=./onjava debug=0 privileged=true

Also, make sure your HelloWorld servlet is mapped-in in your webapps
deployment descriptor.  By the way, the folder should be called WEB-INF not
web-inf.

HTH
stu

-Original Message-
From: Jim Si [mailto:[EMAIL PROTECTED] 
Sent: 29 August 2003 16:57
To: Tomcat Users List; Stuart MacPherson
Subject: Re: First Servlet 404 error

I tried it but it still does not work.  I even tried to put a
HelloWorld.class
file into webapps\onjava\Web-inf\classes directory and use link
http:\\localhost:8080\onjava\servlet\HelloWorld I still have the same error.

But when I put HelloWorld.class file into webapps\examples\Web-inf\classes,
then
it works.  What it might be the problem?

Jim

Stuart MacPherson wrote:

 In your JSP form change this:

 form name=loginForm method=post action=servlet/com.onjava.login
 ..
  /form

 to this:

 form name=loginForm method=POST action=com.onjava.login
 ..
  /form

 [Note the capitals in POST also]

 -Original Message-
 From: Jim Si [mailto:[EMAIL PROTECTED]
 Sent: 28 August 2003 21:37
 To: Tomcat Users List
 Subject: First Servlet 404 error

 It is difficult to get my first servlet working. I got HTTP Status 404 -
 /onjava/servlet/com.onjava.login error.  Maybe something I did not get it
 right.
 Here are the things I have.

 Tomcat 4.1.27

 In conf/server.xml, I added the following line.
   Context className=org.apache.catalina.core.StandardContext
 crossContext=true reloadable=true
 mapperClass=org.apache.catalina.core.StandardContextMapper
 useNaming=true
 debug=0 swallowOutput=false privileged=false displayName=On Java
 Example
 wrapperClass=org.apache.catalina.core.StandardWrapper docBase=onjava
 cookies=true path=/onjava cachingAllowed=true
 charsetMapperClass=org.apache.catalina.util.CharsetMapper
 /Context

 In conf/web.xml, I uncomment the invoker mapping, i.e.
 servlet-mapping
 servlet-nameinvoker/servlet-name
 url-pattern/servlet/*/url-pattern
 /servlet-mapping

 The I have login.jsp and welcome.jsp file under webapps/onjava directory.
 In login.jsp, I have the following code
  form name=loginForm method=post
action=servlet/com.onjava.login
 ..
  /form

 I have login.java file with package statement on top.
 package com.onjava;
 I compiled the code and move the login.class file into
 webapps/onjava/Web-inf/classes/com/onjava directory.

 In webapps/Web-inf/web.xml file,  I have the following line of code.
   ?xml version=1.0 encoding=ISO-8859-1 ?
   !DOCTYPE web-app (View Source for full doctype...)
 - web-app
 - servlet
   servlet-namelogin/servlet-name
   servlet-classcom.onjava.login/servlet-class
   /servlet
 - servlet-mapping
   servlet-namelogin/servlet-name
   url-pattern/servlet/login/url-pattern
   /servlet-mapping
   /web-app

 I am able to get login.jsp by using
http://localhost:8080/onjava/login.jsp.
 But
 when I submit it I got the HTTP status 404 -
 /onjava/servlet/com.onjava.login
 error.

 Anything I did wrong?

 Jim

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: First Servlet 404 error

2003-08-29 Thread Jim Si
I tried it but it still does not work.  I even tried to put a HelloWorld.class
file into webapps\onjava\Web-inf\classes directory and use link
http:\\localhost:8080\onjava\servlet\HelloWorld I still have the same error.

But when I put HelloWorld.class file into webapps\examples\Web-inf\classes, then
it works.  What it might be the problem?

Jim

Stuart MacPherson wrote:

 In your JSP form change this:

 form name=loginForm method=post action=servlet/com.onjava.login
 ..
  /form

 to this:

 form name=loginForm method=POST action=com.onjava.login
 ..
  /form

 [Note the capitals in POST also]

 -Original Message-
 From: Jim Si [mailto:[EMAIL PROTECTED]
 Sent: 28 August 2003 21:37
 To: Tomcat Users List
 Subject: First Servlet 404 error

 It is difficult to get my first servlet working. I got HTTP Status 404 -
 /onjava/servlet/com.onjava.login error.  Maybe something I did not get it
 right.
 Here are the things I have.

 Tomcat 4.1.27

 In conf/server.xml, I added the following line.
   Context className=org.apache.catalina.core.StandardContext
 crossContext=true reloadable=true
 mapperClass=org.apache.catalina.core.StandardContextMapper
 useNaming=true
 debug=0 swallowOutput=false privileged=false displayName=On Java
 Example
 wrapperClass=org.apache.catalina.core.StandardWrapper docBase=onjava
 cookies=true path=/onjava cachingAllowed=true
 charsetMapperClass=org.apache.catalina.util.CharsetMapper
 /Context

 In conf/web.xml, I uncomment the invoker mapping, i.e.
 servlet-mapping
 servlet-nameinvoker/servlet-name
 url-pattern/servlet/*/url-pattern
 /servlet-mapping

 The I have login.jsp and welcome.jsp file under webapps/onjava directory.
 In login.jsp, I have the following code
  form name=loginForm method=post action=servlet/com.onjava.login
 ..
  /form

 I have login.java file with package statement on top.
 package com.onjava;
 I compiled the code and move the login.class file into
 webapps/onjava/Web-inf/classes/com/onjava directory.

 In webapps/Web-inf/web.xml file,  I have the following line of code.
   ?xml version=1.0 encoding=ISO-8859-1 ?
   !DOCTYPE web-app (View Source for full doctype...)
 - web-app
 - servlet
   servlet-namelogin/servlet-name
   servlet-classcom.onjava.login/servlet-class
   /servlet
 - servlet-mapping
   servlet-namelogin/servlet-name
   url-pattern/servlet/login/url-pattern
   /servlet-mapping
   /web-app

 I am able to get login.jsp by using http://localhost:8080/onjava/login.jsp.
 But
 when I submit it I got the HTTP status 404 -
 /onjava/servlet/com.onjava.login
 error.

 Anything I did wrong?

 Jim

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: First Servlet 404 error

2003-08-29 Thread Jim Si
Thank you Stuart for your great help.

HellowWorld servlet works! But I still have one problem.

I got login.jsp in the webapps\onjava directory.  It has
form name=loginForm method=POST action=servlet/com.onjava.login

In login.java, it has
 private String target = /welcome.jsp;
...
  // Forward the request to the target named
  ServletContext context = getServletContext();
  RequestDispatcher dispatcher = context.getRequestDispatcher(target);
  dispatcher.forward(request, response);

In welcome.jsp, it has very simple return statement.
   bWelcome : %= request.getAttribute(USER)

In webapps\onjava\Web-inf\web.xml, I have
servlet
servlet-namelogin/servlet-name
servlet-classcom.onjava.login/servlet-class
/servlet

servlet-mapping
servlet-namelogin/servlet-name
url-pattern/servlet/url-pattern
/servlet-mapping

In a browser, I use http://localhost:8080/onjava/login.jsp and I got the login
screen, then click on submit button.  I got the following error.

HTTP Status 404 - /welcome.jsp
description The requested resource (/welcome.jsp) is not available.

Look like it runs the login class, how do I correct this problem?  Thank you.

 Also, make sure your HelloWorld servlet is mapped-in in your webapps
 deployment descriptor.  By the way, the folder should be called WEB-INF not
 web-inf.


Windows somehow change WEB-INF to Web-inf automatically.  I could not use
WEB-INF.

Jim


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: First Servlet 404 error

2003-08-28 Thread Stuart MacPherson
In your JSP form change this:

form name=loginForm method=post action=servlet/com.onjava.login
..
 /form


to this:

form name=loginForm method=POST action=com.onjava.login
..
 /form

[Note the capitals in POST also]




-Original Message-
From: Jim Si [mailto:[EMAIL PROTECTED] 
Sent: 28 August 2003 21:37
To: Tomcat Users List
Subject: First Servlet 404 error

It is difficult to get my first servlet working. I got HTTP Status 404 -
/onjava/servlet/com.onjava.login error.  Maybe something I did not get it
right.
Here are the things I have.

Tomcat 4.1.27

In conf/server.xml, I added the following line.
  Context className=org.apache.catalina.core.StandardContext
crossContext=true reloadable=true
mapperClass=org.apache.catalina.core.StandardContextMapper
useNaming=true
debug=0 swallowOutput=false privileged=false displayName=On Java
Example
wrapperClass=org.apache.catalina.core.StandardWrapper docBase=onjava
cookies=true path=/onjava cachingAllowed=true
charsetMapperClass=org.apache.catalina.util.CharsetMapper
/Context

In conf/web.xml, I uncomment the invoker mapping, i.e.
servlet-mapping
servlet-nameinvoker/servlet-name
url-pattern/servlet/*/url-pattern
/servlet-mapping

The I have login.jsp and welcome.jsp file under webapps/onjava directory.
In login.jsp, I have the following code
 form name=loginForm method=post action=servlet/com.onjava.login
..
 /form

I have login.java file with package statement on top.
package com.onjava;
I compiled the code and move the login.class file into
webapps/onjava/Web-inf/classes/com/onjava directory.

In webapps/Web-inf/web.xml file,  I have the following line of code.
  ?xml version=1.0 encoding=ISO-8859-1 ?
  !DOCTYPE web-app (View Source for full doctype...)
- web-app
- servlet
  servlet-namelogin/servlet-name
  servlet-classcom.onjava.login/servlet-class
  /servlet
- servlet-mapping
  servlet-namelogin/servlet-name
  url-pattern/servlet/login/url-pattern
  /servlet-mapping
  /web-app

I am able to get login.jsp by using http://localhost:8080/onjava/login.jsp.
But
when I submit it I got the HTTP status 404 -
/onjava/servlet/com.onjava.login
error.

Anything I did wrong?

Jim








-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: First Servlet 404 error

2003-08-28 Thread Jeff Tulley
It looks like you want your form action to actually be servlet/login, or
maybe /onjava/servlet/login  (you can use
%=request.getContextPath()%/servlet/login in the jsp if you don't want
to hardcode your context name).
You have set up the mapping of /servlet/login in your web.xml, not
/servlet/com.onjava.login  That name is only known internally since it
does not have its own servlet-mapping.

Jeff Tulley  ([EMAIL PROTECTED])
(801)861-5322
Novell, Inc., The Leading Provider of Net Business Solutions
http://www.novell.com

 [EMAIL PROTECTED] 8/28/03 2:36:33 PM 
It is difficult to get my first servlet working. I got HTTP Status 404
-
/onjava/servlet/com.onjava.login error.  Maybe something I did not get
it right.
Here are the things I have.

Tomcat 4.1.27

In conf/server.xml, I added the following line.
  Context className=org.apache.catalina.core.StandardContext
crossContext=true reloadable=true
mapperClass=org.apache.catalina.core.StandardContextMapper
useNaming=true
debug=0 swallowOutput=false privileged=false displayName=On Java
Example
wrapperClass=org.apache.catalina.core.StandardWrapper
docBase=onjava
cookies=true path=/onjava cachingAllowed=true
charsetMapperClass=org.apache.catalina.util.CharsetMapper
/Context

In conf/web.xml, I uncomment the invoker mapping, i.e.
servlet-mapping
servlet-nameinvoker/servlet-name
url-pattern/servlet/*/url-pattern
/servlet-mapping

The I have login.jsp and welcome.jsp file under webapps/onjava
directory.
In login.jsp, I have the following code
 form name=loginForm method=post
action=servlet/com.onjava.login
..
 /form

I have login.java file with package statement on top.
package com.onjava;
I compiled the code and move the login.class file into
webapps/onjava/Web-inf/classes/com/onjava directory.

In webapps/Web-inf/web.xml file,  I have the following line of code.
  ?xml version=1.0 encoding=ISO-8859-1 ?
  !DOCTYPE web-app (View Source for full doctype...)
- web-app
- servlet
  servlet-namelogin/servlet-name
  servlet-classcom.onjava.login/servlet-class
  /servlet
- servlet-mapping
  servlet-namelogin/servlet-name
  url-pattern/servlet/login/url-pattern
  /servlet-mapping
  /web-app

I am able to get login.jsp by using
http://localhost:8080/onjava/login.jsp. But
when I submit it I got the HTTP status 404 -
/onjava/servlet/com.onjava.login
error.

Anything I did wrong?

Jim








-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]