当前位置: 技术问答>java相关
请问jsp大虾:在*.jsp文件中可以有自己独立编写的类吗?
来源: 互联网 发布时间:2015-01-25
本文导语: 我的程序如下: register.jsp register 结果出现下列问题 Internal Servlet Error: org.apache.jasper.JasperException: Unable to compile class for JSPC:jakarta-tomcat-3.2.3worklocalhost_8080%2Fexamples_0002fregister_0002ejspregister_jsp_0.java:90:...
我的程序如下:
register.jsp
register
结果出现下列问题
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:jakarta-tomcat-3.2.3worklocalhost_8080%2Fexamples_0002fregister_0002ejspregister_jsp_0.java:90: Type expected.
try{
^
1 error
请问这是什么原因呢?期待着您的解答!
register.jsp
register
结果出现下列问题
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile class for JSPC:jakarta-tomcat-3.2.3worklocalhost_8080%2Fexamples_0002fregister_0002ejspregister_jsp_0.java:90: Type expected.
try{
^
1 error
请问这是什么原因呢?期待着您的解答!
|
class db
{
Connection con;
Statement st;
ResultSet rs;
db()
{
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
//加载 mm.mysql.driver
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ecogrid","dapan","780318");
//创建数据库联接
}
catch (Exception R)
{
System.err.println("Unable to load driver.");
R.printStackTrace();
}
}
}
少了一个"}"
{
Connection con;
Statement st;
ResultSet rs;
db()
{
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
//加载 mm.mysql.driver
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/ecogrid","dapan","780318");
//创建数据库联接
}
catch (Exception R)
{
System.err.println("Unable to load driver.");
R.printStackTrace();
}
}
}
少了一个"}"