You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kurt L Harless <kh...@qwest.net> on 2008/04/06 07:13:56 UTC

Newbie: Question about first Servlet

Greetings,

 

Specifics:

Window XP

TomCat 5.5

Java 1.6

 

Created webapp dirs under;

 

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\

 

Called ch1\WEB-INF\classes

 

In WEB-INF at created a web.xml file with the following contents;

 

<?xml version="1.0" encoding="ISO-8851-1" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

            http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

            version="2.4">

            <servlet>

                        <servlet-name>Chapter1 Servlet</servlet-name>

                        <servlet-class>Ch1Servlet</servlet-class>

            </servlet>

            <servlet-mapping>

                        <servlet-name>Chapter1 Servlet</servlet-name>

                        <url-pattern>/Serv1</url-pattern>

            </servlet-mapping>

</web-app>

 

In the classes subdir to WEB-INF I compile the following java src
successfully

 

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

 

public class Ch1Servlet extends HttpServlet

{

            public void doGet(HttpServletRequest request,
HttpServletResponse response)

            throws IOException 

            {

                        PrintWriter out = response.getWriter();

                        java.util.Date today = new java.util.Date();

                        out.println("<html> " +

                                        "<body>" +

                                        "<h1 align=center>HF\'s Chapter1
Server</h1>" +

                                        "<br>" + today + 

                                        "</body>" + 

                                        "</html>");

            }

}

 

I installed TomCat 5.5 as a windows server and can successfully launch
http://localhost:8080 <http://localhost:8080/>  and get the TomCat initial
page

Under this page I can select the link for TomCat manager and see under
applications an entry for /ch1

 

However, when I try to run  <http://localhost:8080/ch1/Serv1>
http://localhost:8080/ch1/Serv1 I get HTTP Status 404 - /ch1/Serv1

 

Anyone want to help a newbie?

 

 


Re: Newbie: Question about first Servlet

Posted by Karthik Abram <ka...@gmail.com>.
8851-1 - Is that even a valid encoding?


On 4/6/08, Kurt L Harless <kh...@qwest.net> wrote:
> OK, figured it out.
>
> I changed the Character Set to
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> Instead of
>
> <?xml version="1.0" encoding="ISO-8851-1" ?>
>
> I figured this out by using the tomcat.exe to start the service and saw the
> dump message when it was trying to parse my xml file.
>
> Is this not the valid way of coding this encoding?
>
> -----Original Message-----
> From: Kurt L Harless [mailto:kharless@qwest.net]
> Sent: Saturday, April 05, 2008 10:14 PM
> To: users@tomcat.apache.org
> Subject: Newbie: Question about first Servlet
>
> Greetings,
>
>
>
> Specifics:
>
> Window XP
>
> TomCat 5.5
>
> Java 1.6
>
>
>
> Created webapp dirs under;
>
>
>
> C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\
>
>
>
> Called ch1\WEB-INF\classes
>
>
>
> In WEB-INF at created a web.xml file with the following contents;
>
>
>
> <?xml version="1.0" encoding="ISO-8851-1" ?>
>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
>            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>
>            http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>
>            version="2.4">
>
>            <servlet>
>
>                        <servlet-name>Chapter1 Servlet</servlet-name>
>
>                        <servlet-class>Ch1Servlet</servlet-class>
>
>            </servlet>
>
>            <servlet-mapping>
>
>                        <servlet-name>Chapter1 Servlet</servlet-name>
>
>                        <url-pattern>/Serv1</url-pattern>
>
>            </servlet-mapping>
>
> </web-app>
>
>
>
> In the classes subdir to WEB-INF I compile the following java src
> successfully
>
>
>
> import javax.servlet.*;
>
> import javax.servlet.http.*;
>
> import java.io.*;
>
>
>
> public class Ch1Servlet extends HttpServlet
>
> {
>
>            public void doGet(HttpServletRequest request,
> HttpServletResponse response)
>
>            throws IOException
>
>            {
>
>                        PrintWriter out = response.getWriter();
>
>                        java.util.Date today = new java.util.Date();
>
>                        out.println("<html> " +
>
>                                        "<body>" +
>
>                                        "<h1 align=center>HF\'s Chapter1
> Server</h1>" +
>
>                                        "<br>" + today +
>
>                                        "</body>" +
>
>                                        "</html>");
>
>            }
>
> }
>
>
>
> I installed TomCat 5.5 as a windows server and can successfully launch
> http://localhost:8080 <http://localhost:8080/>  and get the TomCat initial
> page
>
> Under this page I can select the link for TomCat manager and see under
> applications an entry for /ch1
>
>
>
> However, when I try to run  <http://localhost:8080/ch1/Serv1>
> http://localhost:8080/ch1/Serv1 I get HTTP Status 404 - /ch1/Serv1
>
>
>
> Anyone want to help a newbie?
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Newbie: Question about first Servlet

Posted by Alan Chaney <al...@compulsivecreative.com>.
Actually

ISO-8851-1 according to Google is a standard determining the moisture 
content of butter.

> http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=35218

However, ISO-8859-1 is the Latin character set definition.

Probably ISO-8859-1 is more relevant. Anyway, you fixed it! Hope you 
have hours of fun learning servlet programming just like the rest of us...


Regards

Alan Chaney




Kurt L Harless wrote:
> OK, figured it out.
> 
> I changed the Character Set to
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> Instead of 
> 
> <?xml version="1.0" encoding="ISO-8851-1" ?>
> 
> I figured this out by using the tomcat.exe to start the service and saw the
> dump message when it was trying to parse my xml file.
> 
> Is this not the valid way of coding this encoding?
> 
> -----Original Message-----
> From: Kurt L Harless [mailto:kharless@qwest.net] 
> Sent: Saturday, April 05, 2008 10:14 PM
> To: users@tomcat.apache.org
> Subject: Newbie: Question about first Servlet
> 
> Greetings,
> 
>  
> 
> Specifics:
> 
> Window XP
> 
> TomCat 5.5
> 
> Java 1.6
> 
>  
> 
> Created webapp dirs under;
> 
>  
> 
> C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\
> 
>  
> 
> Called ch1\WEB-INF\classes
> 
>  
> 
> In WEB-INF at created a web.xml file with the following contents;
> 
>  
> 
> <?xml version="1.0" encoding="ISO-8851-1" ?>
> 
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
> 
>             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 
>             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> 
>             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
> 
>             version="2.4">
> 
>             <servlet>
> 
>                         <servlet-name>Chapter1 Servlet</servlet-name>
> 
>                         <servlet-class>Ch1Servlet</servlet-class>
> 
>             </servlet>
> 
>             <servlet-mapping>
> 
>                         <servlet-name>Chapter1 Servlet</servlet-name>
> 
>                         <url-pattern>/Serv1</url-pattern>
> 
>             </servlet-mapping>
> 
> </web-app>
> 
>  
> 
> In the classes subdir to WEB-INF I compile the following java src
> successfully
> 
>  
> 
> import javax.servlet.*;
> 
> import javax.servlet.http.*;
> 
> import java.io.*;
> 
>  
> 
> public class Ch1Servlet extends HttpServlet
> 
> {
> 
>             public void doGet(HttpServletRequest request,
> HttpServletResponse response)
> 
>             throws IOException 
> 
>             {
> 
>                         PrintWriter out = response.getWriter();
> 
>                         java.util.Date today = new java.util.Date();
> 
>                         out.println("<html> " +
> 
>                                         "<body>" +
> 
>                                         "<h1 align=center>HF\'s Chapter1
> Server</h1>" +
> 
>                                         "<br>" + today + 
> 
>                                         "</body>" + 
> 
>                                         "</html>");
> 
>             }
> 
> }
> 
>  
> 
> I installed TomCat 5.5 as a windows server and can successfully launch
> http://localhost:8080 <http://localhost:8080/>  and get the TomCat initial
> page
> 
> Under this page I can select the link for TomCat manager and see under
> applications an entry for /ch1
> 
>  
> 
> However, when I try to run  <http://localhost:8080/ch1/Serv1>
> http://localhost:8080/ch1/Serv1 I get HTTP Status 404 - /ch1/Serv1
> 
>  
> 
> Anyone want to help a newbie?
> 
>  
> 
>  
> 
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
> !DSPAM:47f86177141196657853550!
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Newbie: Question about first Servlet

Posted by Kurt L Harless <kh...@qwest.net>.
OK, figured it out.

I changed the Character Set to

<?xml version="1.0" encoding="ISO-8859-1"?>

Instead of 

<?xml version="1.0" encoding="ISO-8851-1" ?>

I figured this out by using the tomcat.exe to start the service and saw the
dump message when it was trying to parse my xml file.

Is this not the valid way of coding this encoding?

-----Original Message-----
From: Kurt L Harless [mailto:kharless@qwest.net] 
Sent: Saturday, April 05, 2008 10:14 PM
To: users@tomcat.apache.org
Subject: Newbie: Question about first Servlet

Greetings,

 

Specifics:

Window XP

TomCat 5.5

Java 1.6

 

Created webapp dirs under;

 

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\

 

Called ch1\WEB-INF\classes

 

In WEB-INF at created a web.xml file with the following contents;

 

<?xml version="1.0" encoding="ISO-8851-1" ?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"

            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee

            http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

            version="2.4">

            <servlet>

                        <servlet-name>Chapter1 Servlet</servlet-name>

                        <servlet-class>Ch1Servlet</servlet-class>

            </servlet>

            <servlet-mapping>

                        <servlet-name>Chapter1 Servlet</servlet-name>

                        <url-pattern>/Serv1</url-pattern>

            </servlet-mapping>

</web-app>

 

In the classes subdir to WEB-INF I compile the following java src
successfully

 

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

 

public class Ch1Servlet extends HttpServlet

{

            public void doGet(HttpServletRequest request,
HttpServletResponse response)

            throws IOException 

            {

                        PrintWriter out = response.getWriter();

                        java.util.Date today = new java.util.Date();

                        out.println("<html> " +

                                        "<body>" +

                                        "<h1 align=center>HF\'s Chapter1
Server</h1>" +

                                        "<br>" + today + 

                                        "</body>" + 

                                        "</html>");

            }

}

 

I installed TomCat 5.5 as a windows server and can successfully launch
http://localhost:8080 <http://localhost:8080/>  and get the TomCat initial
page

Under this page I can select the link for TomCat manager and see under
applications an entry for /ch1

 

However, when I try to run  <http://localhost:8080/ch1/Serv1>
http://localhost:8080/ch1/Serv1 I get HTTP Status 404 - /ch1/Serv1

 

Anyone want to help a newbie?

 

 



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org