HTTP Status 500 - /WEB-INF/jsp/black/list.jsp (line: 48, column: 7) "${status.index%2!=0}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${status.index%2!=0}]
<c:forEach items=" ${messageList}" var="message" varStatus="status">
<tr <c:if test="${status.index%2!=0}">style='background-color:#ECF6EE;'</c:if> >
<td><input type="checkbox" /></td>
<td>${status.index +1}</td>
<td>${message.command }</td>
<td>${message.description }</td>
<td><a href="#">修改</a> <a href="#">删除</a>
</td>
</tr>
</c:forEach>
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/micro_message","root","Admin123456");
//sql语句
String sql = "select ID,COMMAND,DESCRIPTION,CONTENT from message";
//创建声明
PreparedStatement statement = conn.prepareStatement(sql);
//执行查询
ResultSet rs = statement.executeQuery();
//查询结果保存到List
List<Message> messageList = new ArrayList<Message>();
while(rs.next()){
Message message = new Message();
messageList.add(message);
message.setId(rs.getString("ID"));
message.setDescription(rs.getString("DESCRIPTION"));
message.setContent(rs.getString("CONTENT"));
message.setCommand(rs.getString("COMMAND"));
}
//向页面传参
req.setAttribute("messageList", messageList);
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
req.getRequestDispatcher("/WEB-INF/jsp/black/list.jsp").forward(req, resp);