<=,>=这些在jsp页面中总是被看成是<=的等值,该怎么样写啊??
求救!以下是我的部分代码:
大家看一下我的Condi这样写错在哪里??String Condi="score <="+xuefenmax+"AND"+"score>="+xuefenmin;
String condition="SELECT * FROM student where"+Condi;
out.println(Condi+", "+condition); // 输出出错!!!
try{
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery(condition);

解决方案 »

  1.   

    <=,>=这些在jsp页面中总是被看成是<=的等值?什么意思?
    String Condi="score <="+xuefenmax+"AND score >="+xuefenmin;
    out.println(Condi+", "+condition); // 输出出错!!!
    出的错误具体是什么?
      

  2.   

    这是这个页面的代码<%@ page contentType="text/html; charset=GBK" %>
    <%@ include file="connection.jsp" %>
    <html>
    <head>
    <title>
    xuefen
    </title>
    </head>
    <body bgcolor="#ffffff">
    <%//获取提交的学分的最大值和最小值:
      String xuefenmax=request.getParameter("xuefenmax");
      if(xuefenmax==null){
         xuefenmax="100";
      }
      String xuefenmin=request.getParameter("xuefenmin");
      if(xuefenmin==null){
         xuefenmin="0";
      }  
      String Condi="score <="+xuefenmax+"AND"+"score>="+xuefenmin;
      String condition="SELECT * FROM student  where"+Condi;
      out.println(Condi+",  "+condition);
      try{
      Connection conn= DriverManager.getConnection(url,user,password);
      Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
      ResultSet rs=stmt.executeQuery(condition);   
      %>
      <center>
      输出<%=Condi%>的学生信息:<br />
      <table border="" bgcolor="#74bbc0">
      <tbody>
      <tr>
      <td width="100">学号</td>
      <td width="100">姓名</td>
      <td width="50">学分</td>
      </tr>
      <%while(rs.next()){ %>
      <tr align="center">
      <td><%=rs.getString(1) %></td>
      <td><%=rs.getString(2) %></td>
      <td ><%=rs.getInt(3) %></td>
      </tr>
      <%} %>
      </tbody>
      </table>
      </center>
    <%
    conn.close();
    }
    catch(SQLException e1){e1.printStackTrace(); out.print("读取数据出错!!");}
    %>
    <br />
    <hr />
    <a href="chap3-4.jsp">返回</a>
    </body>
    </html>
      

  3.   

    String Condi="score <="+xuefenmax+"AND"+"score>="+xuefenmin;
    String condition="SELECT * FROM student where"+Condi;注意字符串之间的空格String Condi="score <= "+xuefenmax+" AND score >= "+xuefenmin;
    String condition="SELECT * FROM student where "+Condi;
      

  4.   

    数据库读出正确了,但是Condi输出存在问题,无法输出'<'?
      

  5.   

    你这句话:输出<%=Condi%>的学生信息:<br />是输出Condi的信息
    经过上面的这个String Condi="score <="+xuefenmax+"AND"+"score>="+xuefenmin;
    你的Condi就是你的SQL的where条件了!
      

  6.   

    这个知道啊,但是输出的Condi显示出来是score="xuefenmax",没有">"和后面的那些
      

  7.   

    就是:Condi的输出是错误的,但是数据库中读出资料又是正确的,比如xuefenmax=8, xuefenmin=7,输出的Condi的值是“输出xuefen = 8的学生信息:”,输不出“xuefen<=8 AND xuefen>=7”的信息,为什么啊??
      

  8.   

    test!!
    好久没来了,看看id还能用不!
      

  9.   

    String Condi="score <="+xuefenmax+"AND"+"score>="+xuefenmin;
    String condition="SELECT * FROM student where"+Condi;
    在上面两句话之后加上下面两句:
    out.println("Condi"=Condi);
    out.println("condition"=condition);
    然后在控制台看看是不是正确地!
      

  10.   

    不好意思写错了:
    out.println("Condi="+Condi);
    out.println("condition="+condition);
      

  11.   

    楼上的那种写法是一样的
    在jbuilder中显示错误,但是IE中显示正确,很是奇怪
      

  12.   

    html中"<"的输出要用&#60表示,已经解决了
      

  13.   

    怎么还在JSP里写SQL啊 现在都是业务逻辑与VIEW分离的MVC的结构的啊