Class.forName(driverName); Connection connection=DriverManager.getConnection(url); Statement statement = connection.createStatement(); String sql="SELECT * FROM "+tableName; ResultSet rs = statement.executeQuery(sql); 

while(rs.next()){
      String biaoti=rs.getString("biaoti");
      out.println("<p></p>");
%>
<a href="wz.jsp"?id=<%=biaoti %> target="_blank"><%= biaoti%></a>
<% 
} rs.close(); 

statement.close(); 

connection.close();
}
catch(Exception e){}
<a href="wz.jsp"?id=<%=biaoti %> target="_blank"><%= biaoti%></a>我想把biaoti传到wz.jsp这个页面去,为什么传过去的都是null值,(只剩下20分了,见谅

解决方案 »

  1.   

    应该不是你这个地方的问题(这个页面查看源文件应该能看到<a href="wz.jsp?id=abc" target="_blank">abc</a>)。
    应该是你wz.jsp 里获取的地方有问题。
    应该
    String biaoti = request.getParameter("id")==null?"": request.getParameter("id");
    out.print(biaoti);
      

  2.   

    谢谢你的回答,还是这儿错了<a href="wz.jsp"?id=<%=biaoti %> target="_blank"><%= biaoti%></a>应该是<a href="wz.jsp?id=<%=biaoti %>“ target="_blank"><%= biaoti%></a>但是我出过去,是乱码,能解决吗?
      

  3.   

    具体怎么个写法啊。能写给我看看嘛?我刚学,不会,我页面设置的编码全是utf-8格式的
      

  4.   

    request.setCharacterEndoding("你的页面编码")
      

  5.   


    String biaoti = request.getParameter("id")==null?"": request.getParameter("id");
    biaoti = new String(biaoti.getBytes("iso-8859-1"),"gbk");//这样转下呢
    //biaoti = new String(biaoti.getBytes("iso-8859-1"),"utf-8");//试试
     out.print(biaoti);
     
      

  6.   

    很感谢,找你的做的,不是乱码了。但是有个疑问String biaoti = request.getParameter("id")==null?"": request.getParameter("id");
    biaoti = new String(biaoti.getBytes("iso-8859-1"),"utf-8");为什么不行?我的页面编码设置request.setCharacterEncoding("utf-8");分比较少,谢谢你的回答
      

  7.   


    你看看jsp的声明的编码是什么。
    <%@ page language="java" contentType="text/html; charset=GBK"%>