
SearchStudent.jsp
<script language="javascript">
function validate2(objForm){
int k = 0;
if(objForm.name.value.length==0){
objForm.name.focus();
k++;
}
if(objForm.year.value.length==0){
objForm.year.focus();
k++;
}
if(objForm.id.value.length==0){
objForm.year.focus();
k++;
}
if(k == 0){
return false;
}
return true;
}
</script>
FoundStudents.jsp
<%
Student search = null;
if(request.getParameter("seek_stud") != null){
//reading params from the SearchStudent form
String name = request.getParameter("name");
String year_prime = request.getParameter("year");
int year, id;
try{
year = Integer.parseInt(year_prime);
}catch(Exception e1){
year = 0;
}
String id_prime = request.getParameter("id");
try{
id = Integer.parseInt("id");
}catch(Exception e2){
id = 0;
}
if(name.length() != 0){
search = StudentsManager.getInstance().studByName1(name);
}
if(year > 0){
search = StudentsManager.getInstance().studByName2(year);
}
if(id > 0){
search = StudentsManager.getInstance().studByName3(id);
}
%>
<html>
<body bgcolor=#4AA02C>
<center>
<h2>Student's data</h2>
<table border="1" cellspacing="1" cellpadding="8" bgcolor= #EBDDE2>
<tr>
<td bgcolor= #FF9966><b>ID</b></td>
<td bgcolor= #FF9966><b>Name</b></td>
<td bgcolor= #FF9966><b>Year</b></td>
</tr>
<tr>
<td><%= search.getId()%></td>
<td><%= search.getName()%></td>
<td><%= search.getYear()%></td>
</tr>
</table>
</center>
</body>
</html>
<%}%>
I get org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.JasperException: An exception occurred processing JSP page /FoundStudents.jsp at line 58
55: <td bgcolor= #FF9966><b>Year</b></td> 56: </tr> 57: <tr> 58: <td><%= search.getId()%></td> 59: <td><%= search.getName()%></td> 60: <td><%= search.getYear()%></td> 61: </tr>

Please consider the question deleted. I changed the code ;)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.