質問編集履歴
2
パスの修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
45
45
|
throws ServletException, IOException {
|
46
46
|
|
47
|
-
String view = "/
|
47
|
+
String view = "/test.jsp";
|
48
48
|
RequestDispatcher dispatcher = request.getRequestDispatcher(view);
|
49
49
|
|
50
50
|
dispatcher.forward(request, response);
|
1
javaコードを追記、補足情報も追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -22,4 +22,35 @@
|
|
22
22
|
```
|
23
23
|
|
24
24
|
また、上記のJSPを実行してから「決定」ボタンを押しても「HTTPステータス 404 – 見つかりません。」になります。
|
25
|
-
パッケージエクスプローラー上でのservletTest.javaの階層はservletTest→src→servletTest→servletTest.java」となっています。
|
25
|
+
パッケージエクスプローラー上でのservletTest.javaの階層はservletTest→src→servletTest→servletTest.java」となっています。
|
26
|
+
|
27
|
+
|
28
|
+
(ServletTest.java)
|
29
|
+
```
|
30
|
+
package servletTest;
|
31
|
+
|
32
|
+
import java.io.IOException;
|
33
|
+
|
34
|
+
import javax.servlet.RequestDispatcher;
|
35
|
+
import javax.servlet.ServletException;
|
36
|
+
import javax.servlet.annotation.WebServlet;
|
37
|
+
import javax.servlet.http.HttpServlet;
|
38
|
+
import javax.servlet.http.HttpServletRequest;
|
39
|
+
import javax.servlet.http.HttpServletResponse;
|
40
|
+
|
41
|
+
@WebServlet("/helloworld")
|
42
|
+
public class ServletTest extends HttpServlet {
|
43
|
+
private static final long serialVersionUID = 1L;
|
44
|
+
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
45
|
+
throws ServletException, IOException {
|
46
|
+
|
47
|
+
String view = "/servletTest/WebContent/test.jsp";
|
48
|
+
RequestDispatcher dispatcher = request.getRequestDispatcher(view);
|
49
|
+
|
50
|
+
dispatcher.forward(request, response);
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|
56
|
+
プロジェクト名はServletTest、パッケージ名も「ServletTest」だと思います。
|