out对象显示错误,如找不到符号。试过很多方法来修复错误。但它仍然显示错误
<%@ page import="java.sql.*" %>
<%!
void loadBuilding() throws Exception
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/crm","root","");
Statement st = con.createStatement() ;
ResultSet rs =st.executeQuery("select name from building where 1") ;
rs.last();
int count=rs.getRow();
if(count>0)
{
rs.beforeFirst();
while(rs.next())
{
out.print("<script>passName('"+rs.getString(1)+"');</script>");
}
}
else
{
out.print("No Buildings Added Yet");
}
}
%>
<%
loadBuilding();
%>
答案 0 :(得分:1)
根据您在out
上调用的方法,您可能需要out
为PrintWriter
,其输出将写入由此生成的响应的OutputStream
JSP。
添加:
PrintWriter out = new PrintWriter (response.getOutputStream ());