帮忙给解决的菜鸟问题

long594531261 2008-03-12 07:10:58


exception

javax.servlet.ServletException: Error instantiating servlet class wm.servlet.sendMess
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
java.lang.Thread.run(Unknown Source)


root cause

java.lang.Error: Unresolved compilation problems:
The import javax.servlet.http cannot be resolved
HttpServlet cannot be resolved to a type
ServletException cannot be resolved to a type
HttpServletRequest cannot be resolved to a type
HttpServletResponse cannot be resolved to a type
ServletException cannot be resolved to a type
RequestDispatcher cannot be resolved to a type
RequestDispatcher cannot be resolved to a type
HttpServletRequest cannot be resolved to a type
HttpServletResponse cannot be resolved to a type
ServletException cannot be resolved to a type

wm.servlet.sendMess.<init>(sendMess.java:7)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
java.lang.reflect.Constructor.newInstance(Unknown Source)
java.lang.Class.newInstance0(Unknown Source)
java.lang.Class.newInstance(Unknown Source)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
java.lang.Thread.run(Unknown Source)

再登陆的时候报上面这个异常,在线等待
sendMess.java
package wm.servlet;

import java.util.*;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

import wm.bean.messFun;

public class sendMess extends HttpServlet{


public void init()throws ServletException
{
}


public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException

{
messFun MF=new messFun();//创建功能对象
String username="";
String title="";
String keyword="";
String email="";
String content="";
String restore="";
String msg="";//自定义错误信息
username=request.getParameter("yhm");
title=request.getParameter("title");
keyword=request.getParameter("keyword");
email=request.getParameter("email");
content=request.getParameter("content");
String ip=request.getRemoteHost();
String sj=MF.gettime();

if(username=="")
msg+="<li>用户名不能为空</li>";
else if(!(MF.validLength(username,3,12)))//验证内容的合法性
msg+="<li>用户名应在3到12位之间</li>";
if(email=="")
msg+="<li>邮箱不能为空</li>";
else if(email.equals("")||(email.indexOf('@')==-1)||(email.indexOf('.')==-1))
msg+="<li>邮箱格式不正确</li>";
if(content=="")
msg+="<li>内容不能为空</li>";
else if(!(MF.validLength(content,10,512)))
msg+="<li>内容应该在10和100字符之间</li>";
response.setContentType("text/html;charset=GBK");
if(msg.equals(""))//如果没有错误
{
boolean result=MF.addMess(ip,title,keyword,email,sj,content,restore,username);
if(result==true)
msg+="留言成功";
else
msg+="留言失败";
request.setAttribute("msg",msg);
RequestDispatcher wm=request.getRequestDispatcher("common.jsp");
wm.forward(request,response);
}
else
{
request.setAttribute("msg",msg);
RequestDispatcher wm=request.getRequestDispatcher("common.jsp");
wm.forward(request,response);
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
doGet(request, response);
}

//Clean up resources
public void destroy()
{
}
}
我知道类名该大写,但这个应该不是主要问题
请高手帮忙解决下
...全文
523 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zapdos 2008-03-12
  • 打赏
  • 举报
回复
看ROOT CAUSE

The import javax.servlet.http cannot be resolved
HttpServlet cannot be resolved to a type
ServletException cannot be resolved to a type
HttpServletRequest cannot be resolved to a type
HttpServletResponse cannot be resolved to a type
ServletException cannot be resolved to a type
RequestDispatcher cannot be resolved to a type
RequestDispatcher cannot be resolved to a type
HttpServletRequest cannot be resolved to a type
HttpServletResponse cannot be resolved to a type
ServletException cannot be resolved to a type

总的来说,类库找不到

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧