JSP文件提示这个错误
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="com.NameDAO();"%>
<%
String op=request.getParameter("op");
NameDAO ud=new NameDAO();
if(op.equals("add"))
ud.addName("李明","男");
if(op.equals("update"))
ud.updateName("李明","女");
if(op.equals("del"))
ud.delName("李明");
out.println(ud.getName());
%>
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 6 in the generated java file
Syntax error on tokens, delete these tokens
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:326)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
追问:改完了还是不行
org.apache.jasper.JasperException: An exception occurred processing JSP page /fs.jsp at line 6
3: <%
4: String op=request.getParameter("op");
5: NameDAO ud=new NameDAO();
6: if(op.equals("add"))
7: ud.addName("李明","男");
8: if(op.equals("update"))
9: ud.updateName("李明","女");
答案:<%@ page import="com.NameDAO();"%>这个错误
应该是<%@ page import="com.NameDAO;"%>
其他:<%@ page import="com.NameDAO"%>
换成这样看看! 把NameDAO那个类要导入的类也加进去。你是存到数据库,自然要加<%@ page import="java.sql.*"%>
上一个:编写jsp代码,使得点出“提交”按钮后,对录入“用户名”“密码”进行验证,不符合条件的弹出对话框提示
下一个:jsp中,用ajax获取数据