이것은 Employee ID를 사용하는 Employee 데이터베이스에서 ID가 정수 값인 간단한 쿼리 일뿐입니다. 나는 정수의 ID 값을 파싱하기위한 연산을 수행했다.서블릿에서 정수 구문 분석
String value = request.getParameter("Employee_ID");
int id = Integer.parseInt(value);
// Step 3: Execute a SQL SELECT query
String sqlStr = "select * from Employee where ID = id ";
하지만 나에게 다음과 같은 오류를 제공합니다 :
Multiple markers at this line
- Line breakpoint:QueryServlet [line: 45] - doGet(HttpServletRequest,
HttpServletResponse)
- The value of the local variable id is not used
내 HTML 파일 :
<html>
<head>
<title>Employee Details</title>
</head>
<body>
<h2>Employee Details</h2>
<form method="get" action="http://localhost:9999/abcd/query">
<b>Select Employee ID:</b>
<input type="text" name="Employee_ID" value="ex101">
<input type="submit" value="Search">
</form>
</body>
</html>
질문에서 오류가 무엇입니까? 하나는 중단 점이고 다른 하나는 경고입니다. 질문에 어떤 오류도 찾을 수 없습니다. – msrd0
@ msrd0 문제는 OP가이 'id'변수를 사용하고 싶어하지만 필요가 없다는 것입니다. –