前提・実現したいこと
健康診断のプログラムを作りたいです。
発生している問題・エラーメッセージ
HealthCheckLogicを型に解決できませんと出てたので、Importして保存しようとしたら、その書き足したimport文が消えてしまう
エラーメッセージ HealthCheckLogicを型に解決できません
該当のソースコード
HealthCheckLogic healthCheckLogic =new HealthCheckLogic();
ソースコード package servlet; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.Health; /** * Servlet implementation class HealthCheck */ @WebServlet("/HealthCheck") public class HealthCheck extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); RequestDispatcher dispatcher= request.getRequestDispatcher("/WEB-INF/jsp/healthCheck.jsp"); dispatcher.forward(request,response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); String weight = request.getParameter("weight"); String height = request.getParameter("height"); Health health = new Health(); health.setHeight(Double.parseDouble(height)); health.setWeight(Double.parseDouble(weight)); HealthCheckLogic healthCheckLogic =new HealthCheckLogic(); healthCheckLogic.execute(health); request.setAttribute("health",health); RequestDispatcher dispatcher= request.getRequestDispatcher("/WEB-INF/jsp/healthCheckResult.jsp"); dispatcher.forward(request,response); } }
試したこと
Import文の記載
補足情報(FW/ツールのバージョンなど)
eclipse