protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out=response.getWriter();
ServletContext context=this.getServletContext();
if(context.getAttribute("count")==null){
context.setAttribute("count", 1);
String num=(String)context.getAttribute("count");
out.println(num);
}else{
Long i=(Long)context.getAttribute("count");
Integer num2=new Integer(String.valueOf(i));
out.println(num2);
}
出现下面错误
严重: Servlet.service() for servlet [my1] in context with path [/first] threw exception
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
求解答