<%=rs.getString("w_count") %><%String insql1="select w_name,w_webname,w_weburl,w_count from web_info where w_count='"+%><%=rs.getString("w_count")%><%+"'"%>;<%String insql1="select w_name,w_webname,w_weburl,w_count from web_info where w_count='"+rs.getString("w_count")+"'";%><%
String zcount=rs.getString("w_count");
String insql1="select w_name,w_webname,w_weburl,w_count from web_info where w_count='"+zcount+"'";
%>
绕不过去的坎啊~    求拯救@!~
我自己想了三种方法 不过都没成功   
连我自己都觉得奇葩够了    = =
这三种基本都是提示找不到值 或者 类型不匹配  可是前头有个 <%=rs.getString("w_count") %>显示完全没问题   求解~

解决方案 »

  1.   

    真够纠结的,rs是个结果集,rs.getString("") 出来也是个集合,怎么能用在条件里 啊?
    还有你先看看你的rs是怎么得到的
      

  2.   

    2个问题:
    1、rs.getString("w_count") 打印的值是多少
    2、把出错的完整信息贴出来
      

  3.   

    type Exception reportmessage Unable to compile class for JSP: description The server encountered an internal error that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 41 in the jsp file: /home.jsp
    The left-hand side of an assignment must be a variable
    38:  String strconn1="JDBC:odbc:byxqdata";
    39:  conn1=DriverManager.getConnection(strconn1);
    40:  Statement stmt1=conn1.createStatement();
    41:  String insql1="select w_name,w_webname,w_weburl,w_count from web_info in w_count='"=rs.getString("w_count")+"'";
    42:  out.println(insql1);
    43:  ResultSet rs1=stmt1.executeQuery(insql1);
    44:  while (rs1.next()){ 
    Stacktrace:
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
    org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.36 logs.
      

  4.   

    还是不成    有个啥法把RS的值取出来不?
    下头这个置入SESSION的就很行   好囧
        String zname=(String)session.getAttribute("sename");
        Connection conn=null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String strconn="JDBC:odbc:byxqdata";
    conn=DriverManager.getConnection(strconn);
    Statement stmt=conn.createStatement();
    String insql="select u_name,w_count from web_count where u_name='"+zname+"'";
    ResultSet rs=stmt.executeQuery(insql);
      

  5.   

    String insql1="select w_name,w_webname,w_weburl,w_count from web_info in w_count='"[color=#000000]=rs.getString("w_count")+"'";[/color]
    这一行编译失败了。先把这个=号改成+,在跑看是什么错。
      

  6.   

    type Exception reportmessage An exception occurred processing JSP page /home.jsp at line 41description The server encountered an internal error that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: An exception occurred processing JSP page /home.jsp at line 4138:  String strconn1="JDBC:odbc:byxqdata";
    39:  conn1=DriverManager.getConnection(strconn1);
    40:  Statement stmt1=conn1.createStatement();
    41:  String insql1="select w_name,w_webname,w_weburl,w_count from web_info in w_count='"+rs.getString("w_count")+"'";
    42:  out.println(insql1);
    43:  ResultSet rs1=stmt1.executeQuery(insql1);
    44:  while (rs1.next()){ 
    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause javax.servlet.ServletException: java.sql.SQLException: No data found
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
    org.apache.jsp.home_jsp._jspService(home_jsp.java:153)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause java.sql.SQLException: No data found
    sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
    sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
    sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
    sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
    org.apache.jsp.home_jsp._jspService(home_jsp.java:120)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.36 logs.NODATAFOUND?    
      

  7.   

    没看明白。。
    你是想第二条sql语句想调用第一条sql语句的执行结果里的值???
      

  8.   

    select w_name,w_webname,w_weburl,w_count from web_info in w_count='"+rs.getString("w_count")+";
    sql语法问题,where都没有,就in了。先该了这个,改完最好直接去数据库执行一把,确定sql没问题。
      

  9.   


    改了下   数据库中使用没问题   把"+rs.getString("w_count")+ 随便改了个字符串页面也没问题  就是加上这个之后报错 说NO DATA FOUND = =
      

  10.   

    想看看rs.getString("w_count")输出的值和完整的查询语句,最后贴下异常。
      

  11.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <%@ page contentType="text/html;charset=gb2312" language="java" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.Date" %>
    <head>
    <title>欢迎回家~</title>
    <link href="css/home.css" type="text/css" rel="stylesheet" />
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    </head>
    <body>
    <%@ include file="menus.jsp" %>
    <div id="main">
      <div id="top">
        <div id="logo">边缘星球</div>
      </div>
      <div id="information">
        <div id="infouser">等级:</div>
        <div id="infouser">账号:</div>
        <div id="content">
          <%
        String zname=(String)session.getAttribute("sename");
        Connection conn=null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String strconn="JDBC:odbc:byxqdata";
    conn=DriverManager.getConnection(strconn);
    Statement stmt=conn.createStatement();
    String insql="select u_name,w_count from web_count where u_name='"+zname+"'";
    ResultSet rs=stmt.executeQuery(insql);
    while (rs.next()){ %>
          <div id="list">
            <div id="listall">
              <div id="listtitle"><%=rs.getString("w_count") %></div>
              <div id="listcontent">
                <%
         Connection conn1=null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String strconn1="JDBC:odbc:byxqdata";
    conn1=DriverManager.getConnection(strconn1);
    Statement stmt1=conn1.createStatement();
    String insql1="select w_name,w_webname,w_weburl,w_count from web_info where w_count='"+rs.getString("w_count")+"'";
    out.println(insql1);
    ResultSet rs1=stmt1.executeQuery(insql1);
    while (rs1.next()){ 
    %>
                    <a><%=rs1.getString("w_webname")%></a>
                    <%}%>
              </div>
            </div>
          </div>
          <%//}%>
          <%}%>
        </div>
      </div>
    </div>
    </body>整页代码都贴出来了   没数据池可能看起来有些晕  = =  纯新手作品