実現したいこと
エクリプスのデバッグモードからステップオーバーで変数の中身を見たい
発生している問題・分からないこと
エクリプスのデバッグモードでif文の中の値に何が入っているか調べようとしたのですがeclipsで実際にやってみると勝手に下記スクショようなタブに飛んで(ステップイン画面?)変数ビューから中身が見れない状態です、
if(charange!=""&&win!="")
changeとwinの変数に何が入っているかを見たいのですが上記のような症状で見られない状態です
該当のソースコード
controller
1package Servlet; 2 3import java.io.IOException; 4 5import javax.servlet.RequestDispatcher; 6import javax.servlet.ServletException; 7import javax.servlet.annotation.WebServlet; 8import javax.servlet.http.HttpServlet; 9import javax.servlet.http.HttpServletRequest; 10import javax.servlet.http.HttpServletResponse; 11 12import model.Mathma; 13import model.ProbilityLogic; 14 15/** 16 * Servlet implementation class ProbilityCheck 17 */ 18@WebServlet("/ProbilityCheck") 19public class ProbilityCheck extends HttpServlet { 20 private static final long serialVersionUID = 1L; 21 22 protected void doGet(HttpServletRequest request, HttpServletResponse response) 23 throws ServletException, IOException { 24 RequestDispatcher dispatcher = request.getRequestDispatcher("WEB-INF/ProbilityCheck.jsp"); 25 26 dispatcher.forward(request, response); 27 } 28 29 /** 30 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 31 */ 32 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 33 34 35 36 String charange =request.getParameter("charange"); 37 String win=request.getParameter("win"); 38 39 40 41 42 43 if(charange!=""&&win!="") { 44 45 46 47 Mathma math=new Mathma(); 48 49 math.setWin(Integer.parseInt(win)); 50 math.setCharange(Integer.parseInt(charange)); 51 52 53 ProbilityLogic probilityLogic=new ProbilityLogic(); 54 55 56 57 probilityLogic.execute(math); 58 59 request.setAttribute("math",math); 60 61 62 } 63 64 else 65 66 { 67 68 //エラーメッセージをリクエストスコープに保存 69 70 request.setAttribute("errorMsg", 71 72 "数値が入力されていません"); 73 74 } 75 76 77 78 79 80 81 82 83 84 RequestDispatcher dispatcher = request.getRequestDispatcher("WEB-INF/ProbilityCheckResult.jsp"); 85 86 dispatcher.forward(request,response); 87} 88 89} 90
jsp
1<%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3<!DOCTYPE html> 4 5<% 6String errorMsg = (String) request.getAttribute("errorMsg"); 7 8 9%> 10 11 12<html> 13<head> 14<meta charset="UTF-8"> 15<title>Insert title here</title> 16</head> 17<body> 18 19 20 <h1>サイトへようこそ</h1> 21 <h1>計算</h1> 22 23 <form action="ProbilityCheck" method="post"> 24 25 <input type="text" name="charange">(回試行して)<br> <input 26 type="text" name="win">(回当たる)<br> <input type="submit" 27 value="送信"> 28 29 </form> 30 31 <% 32 if (errorMsg != null) { 33 %> 34 <p><%=errorMsg%></p> 35 36 <% 37 } 38 %> 39 40</body> 41</html>
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
if(charange!=""&&win!="")の中身をSystem.out.printlnで見ようとしたがサーブレットではコンソールに表示しないらしく、中身を見る事が出来ませんでした
補足
環境>
エクリプス
Version: 2024-12 (4.34.0)
Build id: 20241128-0757
java version "23.0.2" 2025-01-21
Java(TM) SE Runtime Environment (build 23.0.2+7-58)
Java HotSpot(TM) 64-Bit Server VM (build 23.0.2+7-58, mixed mode, sharing)
TomCat9 java17

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。