tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: First Servlet 404 error
Date Tue, 02 Sep 2003 15:19:33 GMT

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:Jim.Si@CalgaryHealthRegion.ca]
>Sent: Tuesday, September 02, 2003 11:11 AM
>To: Tomcat Users List; aprw00@dsl.pipex.com; JTULLEY@novell.com
>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:Jim.Si@CalgaryHealthRegion.ca]
>> 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.
>>    <b>Welcome : <%= request.getAttribute("USER")
>>
>> In webapps\onjava\Web-inf\web.xml, I have
>> <servlet>
>> <servlet-name>login</servlet-name>
>> <servlet-class>com.onjava.login</servlet-class>
>> </servlet>
>>
>> <servlet-mapping>
>> <servlet-name>login</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: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




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.


Mime
View raw message