报错求解答

来源:2-5 数据展示

泉哥仔

2016-07-04 00:32

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>&nbsp;&nbsp;&nbsp; <a href="#">删除</a>

</td>

</tr>

</c:forEach>


写回答 关注

1回答

  • 泉哥仔
    2016-07-04 00:34:03

    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);


通过自动回复机器人学Mybatis---基础版

微信公众号自动回复功能学习Mybatis,基础教程加案例实战方式学习

107412 学习 · 786 问题

查看课程

相似问题