2

Webサーバープログラミングの基礎を勉強しようと思っています。
Ubuntu 12.04にTomcat 7をインストールしました(入力するとすべて機能し、myIp:8080実際には正しいTomcatページが表示されます)。

そして簡単な構造を作成しました:

apache-tomcat-7.0.42/webapps=> hereの下Beer-v1に、このフォルダーWEB-INFフォルダーとform.html.

のコードform.html:

<html>
    <body>
        <h1 align=”center”&gt;Beer Selection Page</h1>
        <form method=”POST” 
            action=”SelectBeer.do”&gt;
            Select beer characteristics<p>
            Color:
            <select name=”color” size=”1”&gt;  
                <option value=”light”&gt; light </option>
                <option value=”amber”&gt; amber </option>
                <option value=”brown”&gt; brown </option>
                <option value=”dark”&gt; dark </option>
            </select>
            <br><br>
            <center>
                <input type=”SUBMIT”&gt;
            </center>
        </form>
    </body>
</html>

WEB -INF に web.xml

のコードweb.xml:

<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/web-app_2_4.xsd”
    version=”2.4”&gt;
    <servlet>
        <servlet-name>Ch3 Beer</servlet-name>
        <servlet-class>com.example.web.BeerSelect</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>Ch3 Beer</servlet-name>
        <url-pattern>/SelectBeer.do</url-pattern>
    </servlet-mapping>
</web-app>

フォルダーに実行bin/startup.shするapache-tomcat-7.0.42と、次の出力が表示されます。

root@nazar-desctop:/usr/local/tomcat/apache-tomcat-7.0.42# bin/startup.sh
Using CATALINA_BASE:   /usr/local/tomcat/apache-tomcat-7.0.42
Using CATALINA_HOME:   /usr/local/tomcat/apache-tomcat-7.0.42
Using CATALINA_TMPDIR: /usr/local/tomcat/apache-tomcat-7.0.42/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /usr/local/tomcat/apache-tomcat-7.0.42/bin/bootstrap.jar:/usr/local/tomcat/apache-tomcat-7.0.42/bin/tomcat-juli.jar

ブラウザで入力した後、 HTTP Status 404 http://localhost:8080/Beer-v1/form.html-
/Beer-v1/form.htmlが表示されます。

何が悪いのかわかりませんでした。

アップデート:

の内容-ここでcatalina.out見ることができます そして:
localhost.2013-09-12.log

Sep 12, 2013 9:17:26 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Sep 12, 2013 9:17:26 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Sep 12, 2013 9:17:27 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@d47feb3')
Sep 12, 2013 9:17:34 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Sep 12, 2013 9:17:34 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Sep 12, 2013 9:17:35 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@27c76b8d')
Sep 12, 2013 9:17:35 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Sep 12, 2013 9:17:35 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Sep 12, 2013 9:21:12 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Sep 12, 2013 9:21:12 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Sep 12, 2013 9:21:14 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@41fb43a2')
Sep 12, 2013 9:21:17 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Sep 12, 2013 9:21:17 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Sep 12, 2013 9:30:38 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Sep 12, 2013 9:30:38 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Sep 12, 2013 9:30:38 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@30ce9337')
Sep 12, 2013 9:30:39 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Sep 12, 2013 9:30:39 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Sep 12, 2013 9:44:30 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Sep 12, 2013 9:44:30 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Sep 12, 2013 9:44:30 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@357c4ab7')
Sep 12, 2013 9:44:31 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Sep 12, 2013 9:44:31 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()

この問題を解決するにはどうすればよいですか?

4

3 に答える 3

4
于 2013-09-13T15:01:52.820 に答える
0
于 2013-09-12T21:04:32.533 に答える