teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

6

追記

2020/06/11 02:31

投稿

rascals
rascals

スコア3

title CHANGED
File without changes
body CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  修正箇所
10
10
  ・doGet処理が足りていないとの指摘を受けたので追記しましたが変わらず同じエラー内容が出ます
11
-
11
+ ・@Overrideの追加
12
12
  ### 発生している問題・エラーメッセージ
13
13
 
14
14
  HTTPのPOSTメソッドは、このURLではサポートされていません。
@@ -88,12 +88,13 @@
88
88
  super();
89
89
  }
90
90
 
91
-
91
+ @Override
92
92
  protected void doGet (HttpServletRequest request, HttpServletResponse response)
93
93
  throws ServletException, IOException {
94
94
  this.doPost(request, response);
95
95
  }
96
96
 
97
+ @Override
97
98
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
98
99
  throws ServletException, IOException {
99
100
 

5

追記

2020/06/11 02:30

投稿

rascals
rascals

スコア3

title CHANGED
File without changes
body CHANGED
@@ -16,6 +16,55 @@
16
16
 
17
17
  ### 該当のソースコード
18
18
 
19
+ Loginbefor.jsp
20
+ ```
21
+ <%@page contentType="text/html" pageEncoding="UTF-8" session="false" %>
22
+ <!DOCTYPE html>
23
+ <html>
24
+ <jsp:include page="header.jsp" flush="true" />
25
+ <body>
26
+ <br>
27
+ <div id="login">
28
+ <table width=25% border="0" cellspacing="0" cellpadding="3" id="loginform">
29
+ <tr class="sub_title1" align="center">
30
+ <b> ログイン入力 </b>
31
+ </tr>
32
+ </table>
33
+
34
+ <form action="/BBS/LoginUser" method="post">
35
+ <table id="loginform">
36
+ <tr>
37
+ <th>ID</th>
38
+ <td><input type="text" name="id" /></td>
39
+ <th></th>
40
+ </tr>
41
+ <tr>
42
+ <th>パスワード</th>
43
+ <td><input type="password" name="pass" /></td>
44
+ </tr><br>
45
+ <td><input type="submit" value="ログイン"></td>
46
+ </table>
47
+ </form>
48
+ <%
49
+ String error = (String)request.getAttribute("error");
50
+ if (error != null) {
51
+ %>
52
+ <p style="color:red; font-size: larger;"><%= error %></p>
53
+ <% } %>
54
+ <br>
55
+ <hr>
56
+
57
+ <li class="main_info_small">
58
+ ※ログインしてご利用いただくためには、<a href="/BBS/RegisterUser">ID登録</a>が必要です。
59
+ </li>
60
+ <input type="hidden" name="KBN" value="login_user" />
61
+ <br>
62
+ <a href="top.html">Topへ戻る</a>
63
+ </div>
64
+ </body>
65
+ </html>
66
+ ```
67
+
19
68
  LoginUser.java
20
69
  ```
21
70
  package LoginUserServlet;

4

追記

2020/06/10 05:54

投稿

rascals
rascals

スコア3

title CHANGED
File without changes
body CHANGED
@@ -7,11 +7,12 @@
7
7
  よろしくお願いします。
8
8
 
9
9
  修正箇所
10
- ・doGet処理がなかったので追記しましたが変わらず同じエラー内容が出
10
+ ・doGet処理が足りていいとの指摘を受けたので追記しましたが変わらず同じエラー内容が出ます
11
11
 
12
12
  ### 発生している問題・エラーメッセージ
13
13
 
14
14
  HTTPのPOSTメソッドは、このURLではサポートされていません。
15
+ The specified HTTP method is not allowed for the requested resource.
15
16
 
16
17
  ### 該当のソースコード
17
18
 

3

追記

2020/06/10 01:00

投稿

rascals
rascals

スコア3

title CHANGED
File without changes
body CHANGED
@@ -6,6 +6,9 @@
6
6
 
7
7
  よろしくお願いします。
8
8
 
9
+ 修正箇所
10
+ ・doGet処理がなかったので追記しましたが変わらず同じエラー内容が出る
11
+
9
12
  ### 発生している問題・エラーメッセージ
10
13
 
11
14
  HTTPのPOSTメソッドは、このURLではサポートされていません。

2

文追加

2020/06/09 08:15

投稿

rascals
rascals

スコア3

title CHANGED
File without changes
body CHANGED
@@ -24,9 +24,7 @@
24
24
  import javax.servlet.http.HttpServletResponse;
25
25
  import javax.servlet.http.HttpSession;
26
26
 
27
- /**
27
+
28
- * Servlet implementation class LoginServlet
29
- */
30
28
  public class LoginUser extends HttpServlet {
31
29
  private static final long serialVersionUID = 1L;
32
30
 
@@ -37,10 +35,12 @@
37
35
  super();
38
36
  }
39
37
 
40
- /**
41
- * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
42
- */
43
38
 
39
+ protected void doGet (HttpServletRequest request, HttpServletResponse response)
40
+ throws ServletException, IOException {
41
+ this.doPost(request, response);
42
+ }
43
+
44
44
  protected void doPost(HttpServletRequest request, HttpServletResponse response)
45
45
  throws ServletException, IOException {
46
46
 

1

誤字

2020/06/09 07:11

投稿

rascals
rascals

スコア3

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,7 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- eclipseを使用してログインの処理をしたいのですが、ログインボタンを押すと、”HTTPのPOSTメソッドは、このURLではサポートされていません。”
3
+ eclipseを使用してログインの処理をしたいのですが、ログインボタンを押すと、
4
+ ”HTTPのPOSTメソッドは、このURLではサポートされていません。”
4
5
  となってしまい実行することができません。
5
6
 
6
7
  よろしくお願いします。
@@ -11,9 +12,9 @@
11
12
 
12
13
  ### 該当のソースコード
13
14
 
14
- RoginUser.java
15
+ LoginUser.java
15
16
  ```
16
- package RoginUserServlet;
17
+ package LoginUserServlet;
17
18
 
18
19
  import java.io.IOException;
19
20
 
@@ -26,13 +27,13 @@
26
27
  /**
27
28
  * Servlet implementation class LoginServlet
28
29
  */
29
- public class RoginUser extends HttpServlet {
30
+ public class LoginUser extends HttpServlet {
30
31
  private static final long serialVersionUID = 1L;
31
32
 
32
33
  /**
33
34
  * @see HttpServlet#HttpServlet()
34
35
  */
35
- public RoginUser() {
36
+ public LoginUser() {
36
37
  super();
37
38
  }
38
39
 
@@ -57,10 +58,10 @@
57
58
 
58
59
  if (isLogin) {
59
60
  request.setAttribute("name", user.getId());
60
- request.getRequestDispatcher("/BBS/roginsuccess.jsp").forward(request, response);
61
+ request.getRequestDispatcher("/BBS/loginsuccess.jsp").forward(request, response);
61
62
  } else {
62
63
  request.setAttribute("error", "IDかパスワードが間違っています。\n再入力してください。");
63
- request.getRequestDispatcher("/roginbefor.html").forward(request, response);
64
+ request.getRequestDispatcher("/loginbefor.html").forward(request, response);
64
65
  }
65
66
 
66
67
  }
@@ -68,7 +69,7 @@
68
69
  ```
69
70
  UserDao.java
70
71
  ```
71
- package RoginUserServlet;
72
+ package LoginUserServlet;
72
73
 
73
74
  import java.sql.Connection;
74
75
  import java.sql.DriverManager;
@@ -80,8 +81,8 @@
80
81
 
81
82
  private static Connection getConnection() {
82
83
  try {
83
- Class.forName("org.postgresql.Driver");
84
+ Class.forName("com.mysql.jdbc.Driver");
84
- return DriverManager.getConnection("jdbc:mysql://localhost:3306/user","root", "root");
85
+ return DriverManager.getConnection("jdbc:mysql://localhost:3306/user","root", "ecosys");
85
86
  } catch (Exception e) {
86
87
  throw new IllegalArgumentException(e);
87
88
  }
@@ -136,7 +137,7 @@
136
137
  ```
137
138
  UserDto.java
138
139
  ```
139
- package RoginUserServlet;
140
+ package LoginUserServlet;
140
141
 
141
142
  public class UserDto {
142
143
  private String id;
@@ -184,12 +185,12 @@
184
185
  </welcome-file-list>
185
186
 
186
187
  <servlet>
187
- <servlet-name>RoginUser</servlet-name>
188
+ <servlet-name>LoginUser</servlet-name>
188
- <servlet-class>RoginUserServlet.RoginUser</servlet-class>
189
+ <servlet-class>LoginUserServlet.LoginUser</servlet-class>
189
190
  </servlet>
190
191
  <servlet-mapping>
191
- <servlet-name>RoginUser</servlet-name>
192
+ <servlet-name>LoginUser</servlet-name>
192
- <url-pattern>/RoginUser</url-pattern>
193
+ <url-pattern>/LoginUser</url-pattern>
193
194
  </servlet-mapping>
194
195
 
195
196
  </web-app>