#10:新規メモを作成する
ここでは、新しいメモを作成する画面を作ります。メモ一覧から「/new」でアクセスしたら、新しいメモを編集フォームで表示します。
(tomcat/webapps/mymemo/NewServlet.java)import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.sql.*;
public class NewServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setAttribute("message", "Create your post");
        String view = "/WEB-INF/views/new.jsp";
        RequestDispatcher dispatcher = request.getRequestDispatcher(view);
        dispatcher.forward(request, response);
    }
}
(tomcat/webapps/WEB-INF/views/new.jsp)<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
        <title>Java - paiza</title>
        <style>body {padding: 30px;}</style>
    </head>
    <body>
        <h1>新規メモ</h1>
        <% String message = (String)request.getAttribute("message");%>
        <p><%= message %></p>
        <form action='create' method='get'>
            <input type='hidden' name='id' value=''>
            <label for='title'>タイトル</label><br>
            <input type='text' name='title' value=''>
            <p></p>
            <label for='content'>本文</label><br>
            <textarea name='content' cols='40' rows='10'></textarea>
            <p></p>
            <button type='submit'>保存する</button>
            <a href='list'>キャンセル</a>
        </form>
    </body>
</html>
- Javaの道>Servlet・JSP
  https://www.javaroad.jp/servletjsp/index.html
- Servletアプリ開発:目次 - Web系開発メモ
  http://web-dev.hatenablog.com/entry/java/servlet/dev-restful-app/table-of-contents