jsp中<%     <     %>第二个<和第三个>匹配了,是怎么回事啊!

解决方案 »

  1.   

    <% %> 中间只能写java代码哦,不要混入其它符号.不然就是">" 这样的字符串
      

  2.   

    我写的是java代码,中间的小于符号“<”居然会与后面的“%>”匹配,搞不懂,老是出这样的问题!
      

  3.   

    <%
    int id = Integer.parseInt(request.getParameter("id"));
    int pid = Integer.parseInt(request.getParameter("pid"));
    boolean isLeaf = Boolean.getBoolean(request.getParameter("isLeaf"));
    Connection conn=DB.getConn();
    boolean autoCommit=true;
    Statement stmt=null;
    ResultSet rs=null;
     try{ autoCommit = conn.getAutoCommit();
    conn.setAutoCommit(false);

    delete(conn,id,isLeaf);

    stmt = DB.createStmt(conn);
    rs = DB.executeQuery(stmt, "select count(*) from article where pid="+pid);
    rs.next();
    int count =rs.getInt(1);

    if(count<=0){
    DB.executeUpdate(conn, "update article set isleaf = 0 where id = "+id);
    }
    conn.commit();
     }finally{
    conn.setAutoCommit(autoCommit);
    DB.close(rs);
    DB.close(stmt);
    DB.close(conn);
    %>第一个“<%”与最后一个“%>”匹配不上,而“if(count<=0){”中的小于符号(<)与最后的“%>”匹配了!
      

  4.   

    试了下,可能是IDE的问题吧,我的就不会。只要运行不报问题就对了。
      

  5.   

    在JSP中这种情况<%     <     %>确实会报错的。
    会自动中断<%  %>标签。
    不过你可以多写几个标签即可
    如:
    <% 
      for(int i=0;i<10;i...){
        int name = 1;
     %>
       <input name="xxx">
        html代码.....
    <%
      }
    %>
      

  6.   

    不好意思,是我的错,我的“finally{”后面没有匹配的“}”,但是关于jsp中<%     <     %>第二个<和第三个>匹配的问题不是存在的!谢谢各位了!
      

  7.   

    不好意思,是我的错,我的“finally{”后面没有匹配的“}”,但是关于jsp中<%     <     %>第二个<和第三个>匹配的问题还是存在的!谢谢各位了!