我想在JSP中添加更新功能。我添加了所有功能,如添加,删除,更新等所有功能都完美正常。包含搜索功能,但是当我单击搜索功能时,如果在数据库中找不到JSP页面中未显示的数据。其他部分正在显示。任何人都可以帮忙解决问题吗?我在下面添加了代码。
<%
if (request.getAttribute("dName") != null) {
out.println("Your query is Found");
String dName = (String) request.getAttribute("dName");
String dId = (String) request.getAttribute("dId");
out.println("Department Name:" + dName);
out.println("Department Id:" + dId);
request.setAttribute("dName", null);
request.setAttribute("dId", null);
} else {
out.flush();
out.println("dhfdhfj");
}
%>
答案 0 :(得分:0)
已更改为
Integer dId = (Integer) request.getAttribute("dId");