<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="entity.StudentInfo, dao.StudentDao" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'index.jsp' starting page</title> <link rel="stylesheet" type="text/css" href="styles.css">

  <style type="text/css">
   .table{width: 700px;
      text-align:center;
   }
   .td1{text-align: center;
    font-size: 20px;
    font-weight: bold;
   }
  </style>
  </head>
  
  <script type="text/javascript">
  
  </script>
  
  <body>
  <form method="post" name="student">
    <table border="1" class="table">
     <tr height="80px">
     <td class="td1" colspan="6">学员信息列表</td>
     </tr>
     <tr>
     <td>学员编号</td>
     <td>学员姓名</td>
     <td>学员性别</td>
     <td>学员年龄</td>
     <td>家庭住址</td>
     <td>Email</td>
     </tr>
<c:forEach var="list" items="${list}" varStatus="status" >
   <tr <c:if test="${status.index%2==1 }">
   style="background-color:red;"
   </c:if>>
<td><a href="login.do?sid=2">${list.sid}</a></td>
<td>${list.sname}</td>
<td>${list.sgender}</td>
<td>${list.sage}</td>
<td>${list.saddress}</td>
<td>${list.semail}</td>
</tr>
</c:forEach>
    </table>
    </form>
  </body>
</html>jsp1内的代码
package servlet;import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;import dao.StudentDao;
import entity.StudentInfo;public class StudentInfoServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
StudentDao sd=new StudentDao();
List<StudentInfo> list= sd.getAll();
request.setAttribute("list",list);
request.getRequestDispatcher("index.jsp").forward(request, response);
String sid=request.getParameter("sid");
int s=0;
if(sid!=null || sid!=""){
s=Integer.parseInt(sid);
List<StudentInfo> list1=sd.getStuByNum(s);
request.setAttribute("sid", s);
request.getRequestDispatcher("updateStu.jsp").forward(request, response);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}}servlet代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>My JSP 'updateStu.jsp' starting page</title>
    
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
  <style type="text/css">
   table{width: 500px;
     text-align: center;
   }
   .td{font-size: 30px;
   font-weight: bold;
   }
  </style>
  </head>
  
  <body>
    <form method="post" name="stu" action="index.jsp">
    <table bordercolor="1">
     <tr rowspan="2">
     <td colspan="2" class="td">学员信息</td>
     </tr>
     <tr>
     <td>学员姓名</td>
     <c:forEach var="sname" items="${list1 }" varStatus="status">
     <td>${list1.sname }</td>
     </c:forEach>
     </tr>
          <tr>
     <td>学员性别</td>
     <c:forEach items="${list1 }">
     <td>${list1.sgender }</td>
     </c:forEach>
     </tr>
          <tr>
     <td>学员年龄</td>
     <c:forEach items="${list1 }">
     <td>${list1.sage }</td>
     </c:forEach>
     </tr>
          <tr>
     <td>学员地址</td>
     <c:forEach items="${list1 }">
     <td>${list1.saddress }</td>
     </c:forEach>
     </tr>
          <tr>
     <td>Email</td>
     <c:forEach items="${list1 }">
     <td>${list1.semail }</td>
     </c:forEach>
     </tr>
    </table>
    </form>
  </body>
</html>jsp2代码
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
servlet.StudentInfoServlet.doGet(StudentInfoServlet.java:26)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)错误信息servletjspjava