为什么我在eclipse中运行显示找不到Servlet。jar
上面的问题已经解决了这是我的代码importjavax.servlet.http.*;importjava.io.*;importjavax.servlet.*;publ...
上面的问题已经解决了
这是我的代码
import javax.servlet.http.*;
import java.io.*;
import javax.servlet.*;
public class cunterServlet extends HttpServlet {
public void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException{
ServletContext context=getServletContext();
Integer count=(Integer)context.getAttribute("counter");
if(count==null){
count=new Integer(1);
}
else{
count=new Integer(count.intValue()+1);
}
resp.setContentType("text/html;charset=gb2312");
PrintWriter out=resp.getWriter();
out.println("<html><head>");
out.println("<title>登陆次数测试</title></head>");
out.println("<body>"+count);
out.println("</body></html>");
context.setAttribute("counter", count);
out.close();
}
}
java.lang.NoSuchMethodError: main
Exception in thread "main"
好像说是环境配错了,有高手帮忙看看吗 展开
这是我的代码
import javax.servlet.http.*;
import java.io.*;
import javax.servlet.*;
public class cunterServlet extends HttpServlet {
public void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException{
ServletContext context=getServletContext();
Integer count=(Integer)context.getAttribute("counter");
if(count==null){
count=new Integer(1);
}
else{
count=new Integer(count.intValue()+1);
}
resp.setContentType("text/html;charset=gb2312");
PrintWriter out=resp.getWriter();
out.println("<html><head>");
out.println("<title>登陆次数测试</title></head>");
out.println("<body>"+count);
out.println("</body></html>");
context.setAttribute("counter", count);
out.close();
}
}
java.lang.NoSuchMethodError: main
Exception in thread "main"
好像说是环境配错了,有高手帮忙看看吗 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询