当前页面: 开发资料首页 → J2EE 专题 → 书中的例子,这个错误该怎样解决。
书中的例子,这个错误该怎样解决。
摘要: 书中的例子,这个错误该怎样解决。
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class HttpSessionServlet extends HttpServlet{
public void init(ServletConfig config)
throws ServertException{
super.init(config);
}
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IoException{
String [] movies=null;
HttpSession session=request.getSession(true);
if (session!=null){
movies=(String[])session.getAttribute("Movies");
}
response.setContentType("text/html");
PrintWriter out=response.getWriter();
out.println("");
out.println("<head>
Session Servlet</head>");
out.println("<body>");
out.println("
thank you for purchasing;
");
for(int x=0;x
out.println(movies[x]+"
");
}
out.println("<body>");
out.close();
}
}
F:/mycode/HttpSessionServlet>javac HttpSessionServlet.java
HttpSessionServlet.java:7: cannot resolve symbol
symbol : class ServertException
location: class HttpSessionServlet
throws ServertException{
^
HttpSessionServlet.java:11: cannot resolve symbol
symbol : class IoException
location: class HttpSessionServlet
throws ServletException,IoException{
^
2 errors
ServertException 拼错了
IoException O大小写问题
仔细点
谢谢了 ,我这个书 不是很清楚 ,还有很多关键字 我也不很明白,谢谢你的指导
kevinliuu(@。@) 正解。JAVA是区分大小写的!