JSPからSubmitした際に、500エラーが発生してしまいました。
ログを見ても分からないのでご教示ください。
paramjsp
1<%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3<!DOCTYPE html> 4<html> 5<head> 6<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 7<title>いろいろなパラメータの確認</title> 8</head> 9<body> 10 <h2>いろんなパラーメータ</h2> 11 12 <form action="../ParamListServlet"> 13 <p>テキストフィールド</p> 14 <input type="text" name="text1" value="テキストフィールド"> 15 16 <p>テキストエリア</p> 17 <textarea rows="5" cols="30" name="textarea1">テキストエリア</textarea> 18 19 <p>ラジオボックス</p> 20 <input type="radio" name="radio1" value="value1" checked>左 21 <input type="radio" name="radio1" value="value2">右 22 23 <p>チェックボックス</p> 24 <input type="checkbox" name="check1">ゴルフ 25 <input type="checkbox" name="check2">テニス 26 <input type="checkbox" name="check3">サッカー 27 28 <p>セレクト</p> 29 <select name="lang" size="3" multiple> 30 <option value="sel1">VB 31 <option value="sel2">Java 32 <option value="sel3">C 33 </select> 34 35 <p></p> 36 37 <input type="submit"> 38 <input type="reset"> 39 </form> 40</body> 41</html>
ParamListServlet
1package input; 2 3import java.io.IOException; 4import java.io.PrintWriter; 5import java.util.Enumeration; 6 7import javax.servlet.ServletException; 8import javax.servlet.annotation.WebServlet; 9import javax.servlet.http.HttpServlet; 10import javax.servlet.http.HttpServletRequest; 11import javax.servlet.http.HttpServletResponse; 12 13/** 14 * Servlet implementation class ParamListServlet 15 */ 16@WebServlet("/ParamListServlet") 17public class ParamListServlet extends HttpServlet { 18 private static final long serialVersionUID = 1L; 19 20 /** 21 * @see HttpServlet#HttpServlet() 22 */ 23 public ParamListServlet() { 24 super(); 25 // TODO Auto-generated constructor stub 26 } 27 28 /** 29 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 30 */ 31 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 32 33 request.setCharacterEncoding("UTF-8"); 34 35 response.setCharacterEncoding("text/plain; charset=UTF-8"); 36 PrintWriter out = response.getWriter(); 37 38 Enumeration<String> names = request.getParameterNames(); 39 40 while(names.hasMoreElements()) { 41 String name = names.nextElement(); 42 String[] values = request.getParameterValues(name); 43 for (int i = 0; i < values.length; i++) { 44 out.println(name + "=" + values[i]); 45 } 46 } 47 } 48 49 /** 50 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 51 */ 52 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 53 // TODO Auto-generated method stub 54 doGet(request, response); 55 } 56 57}
重大: サーブレット input.ParamListServlet のServlet.service()が例外を投げました 重大: Error processing request 0:0:0:0:0:0:0:1 - - [15/Mar/2019:00:13:23 +0900] "GET /basic/jsp/param.jsp HTTP/1.1" 200 533 0:0:0:0:0:0:0:1 - - [15/Mar/2019:00:13:25 +0900] "GET /basic/ParamListServlet?text1=%E3%83%86%E3%82%AD%E3%82%B9%E3%83%88%E3%83%95%E3%82%A3%E3%83%BC%E3%83%AB%E3%83%89 HTTP/1.1" 500 -
回答1件
あなたの回答
tips
プレビュー