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

質問編集履歴

1

修正

2019/05/08 03:26

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -13,70 +13,4 @@
13
13
 
14
14
  ```
15
15
 
16
- ご指摘お願いします。
16
+ ご指摘お願いします。
17
-
18
- ```ここに言語名を入力
19
- java eclipse使用
20
-
21
- ソースコード
22
- ```
23
- package org.mypackage.sample;
24
-
25
- import java.io.IOException;
26
- import java.io.PrintWriter;
27
-
28
- import javax.servlet.ServletException;
29
- import javax.servlet.annotation.WebServlet;
30
- import javax.servlet.http.HttpServlet;
31
- import javax.servlet.http.HttpServletRequest;
32
- import javax.servlet.http.HttpServletResponse;
33
-
34
- /**
35
- * Servlet implementation class Method4
36
- */
37
- @WebServlet("/Method4")
38
- public class Method4 extends HttpServlet {
39
- private static final long serialVersionUID = 1L;
40
-
41
- /**
42
- * @see HttpServlet#HttpServlet()
43
- */
44
- public Method4() {
45
- super();
46
- // TODO Auto-generated constructor stub
47
- }
48
-
49
- /**
50
- * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
51
- */
52
-
53
- /*メソッド*/
54
- boolean calculation(int num){
55
- boolean num=100+300;
56
-
57
- return num;
58
- }
59
-
60
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
61
- // TODO Auto-generated method stub
62
- response.setContentType("text/html;charset=UTF-8");
63
- try (PrintWriter out = response.getWriter()) {
64
- /* boolean num= calculation(); */
65
-
66
- if (calculation(num)) {
67
- out.print("200以上です。");
68
- }
69
-
70
- }
71
-
72
- }
73
-
74
- /**
75
- * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
76
- */
77
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
78
- // TODO Auto-generated method stub
79
- doGet(request, response);
80
- }
81
-
82
- }