当前位置: 技术问答>java相关
分儿多多!jsp调用javabean老是报Unclosed jsp:useBean tag错误!
来源: 互联网 发布时间:2015-06-29
本文导语: jsp代码: javabean代码: package rsstr; import java.sql.*; import java.util.*; public class adviser { String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver"; String sConnStr = "jdbc:odbc:mms"; ...
jsp代码:
javabean代码:
package rsstr;
import java.sql.*;
import java.util.*;
public class adviser
{
String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String sConnStr = "jdbc:odbc:mms";
Connection conn=null;
Statement Stmt = null;
ResultSet rs =null;
String tt;
public adviser()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); /*加载驱动程序*/
}
catch(java.lang.ClassNotFoundException e)
{
System.out.print("Connect to Database error: " + e.getMessage());
}
}
public String advisera()
{
conn=null;
Stmt=null;
rs=null;
try
{
String url="jdbc:odbc:mms";
String asql="select ddadviserid,ddbuttonfile from RI_ADVISER";
conn=DriverManager.getConnection(url,"mms","mms");
Stmt = conn.createStatement();
rs = Stmt.executeQuery(asql);
while (rs.next())
{
tt=rs.getString("ddbuttonfile")+"*";
}
}
catch(Exception ex)
{
}
return tt;
}
}
javabean代码:
package rsstr;
import java.sql.*;
import java.util.*;
public class adviser
{
String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
String sConnStr = "jdbc:odbc:mms";
Connection conn=null;
Statement Stmt = null;
ResultSet rs =null;
String tt;
public adviser()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); /*加载驱动程序*/
}
catch(java.lang.ClassNotFoundException e)
{
System.out.print("Connect to Database error: " + e.getMessage());
}
}
public String advisera()
{
conn=null;
Stmt=null;
rs=null;
try
{
String url="jdbc:odbc:mms";
String asql="select ddadviserid,ddbuttonfile from RI_ADVISER";
conn=DriverManager.getConnection(url,"mms","mms");
Stmt = conn.createStatement();
rs = Stmt.executeQuery(asql);
while (rs.next())
{
tt=rs.getString("ddbuttonfile")+"*";
}
}
catch(Exception ex)
{
}
return tt;
}
}
|
try:
改为:
改为:
|
错误:Unclosed jsp:useBean tag
应该就是少了"/"。
应该就是少了"/"。