Tomcatの設定ファイルが必要だった。web.xml | tabi0のブログ

tabi0のブログ

(^^)/

servlet-name :適当(servletとservlet-mappingで同じもの)
url-pattern :アクセスするURL
servlet-class :上記のURLでアクセスされた時に呼び出すクラス
---
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>ServletTest</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
    <servlet>
        <servlet-name>hello</servlet-name>
        <servlet-class>ServletMain</servlet-class>
        </servlet>
    <servlet-mapping>
        <servlet-name>hello</servlet-name>
        <url-pattern>/test</url-pattern>
    </servlet-mapping>
</web-app>