当前位置: 代码迷 >> Java Web开发 >> 诸位大侠,请赐小弟一招吧!两天了
  详细解决方案

诸位大侠,请赐小弟一招吧!两天了

热度:9999   发布时间:2013-02-25 21:17:35.0
各位大侠,请赐小弟一招吧!两天了!
错误提示:
org.apache.jasper.JasperException: Unable to 

compile class for JSP: 

An error occurred at line: 8 in the generated 

java file
Only a type can be imported. 

com.bjsxt.registration.service.UserManager 

resolves to a package

An error occurred at line: 9 in the generated 

java file
Only a type can be imported. 

com.bjsxt.registration.model.User resolves to a 

package

An error occurred at line: 12 in the jsp file: 

/Webroot/registerDeal.jsp
User cannot be resolved to a type
9: String password = request.getParameter

("password");
10: String password2 = 

request.getParameter("password2");
11:
12: User u = new User();
13: u.setUsername(username);
14: u.setPassword(password);
15: Class.forName

("org.gjt.mm.mysql.Driver");


An error occurred at line: 12 in the jsp file: 

/Webroot/registerDeal.jsp
User cannot be resolved to a type
9: String password = request.getParameter

("password");
10: String password2 = 

request.getParameter("password2");
11:
12: User u = new User();
13: u.setUsername(username);
14: u.setPassword(password);
15: Class.forName

("org.gjt.mm.mysql.Driver");


An error occurred at line: 18 in the jsp file: 

/Webroot/registerDeal.jsp
UserManager cannot be resolved to a type
15: Class.forName

("org.gjt.mm.mysql.Driver");
16: Connection conn = 

DriverManager.getConnection

("jdbc:mysql://localhost/spring" , "root" , 

"mysqladmin");
17:
18: UserManager um = new UserManager();
19: boolean exist = um.exists(u);
20: if(exist){
21: response.sendRedirect

("registerFail.jsp");


An error occurred at line: 18 in the jsp file: 

/Webroot/registerDeal.jsp
UserManager cannot be resolved to a type
15: Class.forName

("org.gjt.mm.mysql.Driver");
16: Connection conn = 

DriverManager.getConnection

("jdbc:mysql://localhost/spring" , "root" , 

"mysqladmin");
17:
18: UserManager um = new UserManager();
19: boolean exist = um.exists(u);
20: if(exist){
21: response.sendRedirect

("registerFail.jsp");


Stacktrace:


org.apache.jasper.compiler.DefaultErrorHandler.

javacError(DefaultErrorHandler.java:92)


org.apache.jasper.compiler.ErrorDispatcher.java

cError(ErrorDispatcher.java:330)


org.apache.jasper.compiler.JDTCompiler.generate

Class(JDTCompiler.java:423)


org.apache.jasper.compiler.Compiler.compile

(Compiler.java:317)


org.apache.jasper.compiler.Compiler.compile

(Compiler.java:295)


org.apache.jasper.compiler.Compiler.compile

(Compiler.java:282)


org.apache.jasper.JspCompilationContext.compile

(JspCompilationContext.java:586)


org.apache.jasper.servlet.JspServletWrapper.ser

vice(JspServletWrapper.java:317)


org.apache.jasper.servlet.JspServlet.serviceJsp

File(JspServlet.java:342)


org.apache.jasper.servlet.JspServlet.service

(JspServlet.java:267)
javax.servlet.http.HttpServlet.service

(HttpServlet.java:717)

registerDeal.jsp代码:
<%@ page language="java" contentType="text/html" pageEncoding="GB18030"%>
<%@ page import="java.util.* , java.sql.*"%>
  相关解决方案