javax.servlet.http.HttpServlet.service这是在哪个包里面啊

问题描述

错误:cn.com.jbaptech.javaoraprj.faqtool.CommandException:AddCommand:NoDriverAvailable!cn.com.jbaptech.javaoraprj.faqtool.AddCommand.execute(AddCommand.java:35)cn.com.jbaptech.javaoraprj.faqtool.FaqAdminServlet.service(FaqAdminServlet.java:25)javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

解决方案

解决方案二:
javax.servlet.http.HttpServlet在servlet-api.jar
解决方案三:
servlet-api.jar
解决方案四:
那怎样将它导入到工程里面?我用的是myeclipse
解决方案五:
这是运行环境中的包,不需要导入到classpath中的。
解决方案六:
那我这是什么错啊错误:atcn.com.jbaptech.javaoraprj.faqtool.AddCommand.execute(AddCommand.java:35)atcn.com.jbaptech.javaoraprj.faqtool.FaqAdminServlet.service(FaqAdminServlet.java:25)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:717)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)atjava.lang.Thread.run(UnknownSource)AddCommand.java代码:packagecn.com.jbaptech.javaoraprj.faqtool;importjavax.servlet.*;importjavax.servlet.http.*;publicclassAddCommandimplementsCommand{privateStringnext;publicAddCommand(Stringnext){this.next=next;}publicStringexecute(HttpServletRequestreq)throwsCommandException{try{if(CommandToken.isValid(req)){FaqRepositoryfaqs=FaqRepository.getInstance();FaqBeanfaq=newFaqBean();faq.setQuestion(req.getParameter("question"));faq.setAnswer(req.getParameter("answer"));faqs.put(faq);req.setAttribute("faqtool.msg","FAQAddedSuccessfully");}else{req.setAttribute("faqtool.msg","InvalidReloadAttempted");}returnnext;}catch(FaqRepositoryExceptionfe){thrownewCommandException("AddCommand:"+fe.getMessage());}}}FaqAdminServlet.java代码:packagecn.com.jbaptech.javaoraprj.faqtool;importjava.io.*;importjavax.servlet.*;importjavax.servlet.http.*;importjavax.servlet.http.HttpServlet.*;importjava.util.*;publicclassFaqAdminServletextendsHttpServlet{privateHashMapcommands;privateStringerror="error.jsp";privateStringjspdir="/faqtool/";publicvoidinit(ServletConfigconfig)throwsServletException{super.init(config);initCommands();}publicvoidservice(HttpServletRequestreq,HttpServletResponseres)throwsServletException,IOException{Stringnext;try{Commandcmd=lookupCommand(req.getParameter("cmd"));next=cmd.execute(req);CommandToken.set(req);}catch(CommandExceptione){req.setAttribute("javax.servlet.jsp.jspException",e);next=error;}RequestDispatcherrd;rd=getServletContext().getRequestDispatcher(jspdir+next);rd.forward(req,res);}privateCommandlookupCommand(Stringcmd)throwsCommandException{if(cmd==null)cmd="main-menu";if(commands.containsKey(cmd.toLowerCase()))return(Command)commands.get(cmd.toLowerCase());elsethrownewCommandException("InvalidCommandIdentifier");}privatevoidinitCommands(){commands=newHashMap();commands.put("main-menu",newNullCommand("menu.jsp"));commands.put("abort",newAbortCommand("menu.jsp"));commands.put("add",newNullCommand("add.jsp"));commands.put("do-add",newAddCommand("menu.jsp"));commands.put("update-menu",newGetAllCommand("upd_menu.jsp"));commands.put("update",newGetCommand("update.jsp"));commands.put("do-update",newUpdateCommand("menu.jsp"));commands.put("delete-menu",newGetAllCommand("del_menu.jsp"));commands.put("delete",newGetCommand("delete.jsp"));commands.put("do-delete",newDeleteCommand("menu.jsp"));}}求救!!!!!!!!!!!!!
解决方案七:
还有个错误:cn.com.jbaptech.javaoraprj.faqtool.CommandException:AddCommand:NoDriverAvailable!
解决方案八:
这个方法的错35行错了publicStringexecute(HttpServletRequestreq)throwsCommandException{try{if(CommandToken.isValid(req)){FaqRepositoryfaqs=FaqRepository.getInstance();FaqBeanfaq=newFaqBean();faq.setQuestion(req.getParameter("question"));faq.setAnswer(req.getParameter("answer"));faqs.put(faq);req.setAttribute("faqtool.msg","FAQAddedSuccessfully");}else{req.setAttribute("faqtool.msg","InvalidReloadAttempted");}returnnext;}catch(FaqRepositoryExceptionfe){thrownewCommandException("AddCommand:"+fe.getMessage());}}}

解决方案九:
驱动有问题引用6楼fengyu12345的回复:

还有个错误:cn.com.jbaptech.javaoraprj.faqtool.CommandException:AddCommand:NoDriverAvailable!

解决方案十:
我已经被这个问题困扰两天了,大侠们帮帮忙!!!!
解决方案十一:
我这好像没有35行啊,怎么会错呢?如果是驱动问题,那我跑其他代码的怎么没问题
解决方案十二:
就这个方法错了你自己找找吧publicStringexecute(HttpServletRequestreq)throwsCommandException{异常信息写的啊没有有效的驱动
解决方案十三:
还是谢谢你啊
解决方案十四:
很少用MyEclipse,一般都tomcat+Eclipse,那个jar在tomcat下就有,看看你的部署环境吧
解决方案十五:
我这是不是缺少什么包啊
解决方案:
tomcat要部署环境吗?我以前还都没部署过
解决方案:
没servlet-API.jar
解决方案:
servlet-api.jar包要自己导入吗
解决方案:
可以把你TOMCAT解压开的common/lib目录下的servlet-APIjar复制到项目里
解决方案:
那要复制到哪个目录下呢
解决方案:
项目的WEB-INF/lib下
解决方案:
servlet-api.ja
解决方案:
我怀疑你建的是web项目不?

时间: 2024-10-24 21:33:26

javax.servlet.http.HttpServlet.service这是在哪个包里面啊的相关文章

JavaWeb: 报错信息The superclass “javax.servlet.http.HttpServlet”

好久不写Jsp,今天建立了一个Javaweb工程,并在eclipse中配置了Web容器Tomcat.原本开心的新建jsp页面,添加一个简单的Java类.可是,JSP页面顶端出现"红色"的报错信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path.原来Javaweb工程类中没有添加Tomcat运行时相关类导致. 下面是具体的解决方法: 1.右击web

java 出现问题javax.servlet.http.HttpServlet was not found解决方法_java

javax.servlet.http.HttpServlet was not found:          最近做项目发现这个javax.servlet.http.HttpServlet was not found错误问题,经过上网查询解决了,这里记录下,可能能帮助到有需要的朋友. 1.我们遇到的错误显示如下: 2.我们右击有错误提示的文件夹,如下: 3.我们点击"配置构建路径",如下: 4.我们再点击"添加库",如下: 5.我们选中上图中标出的选项,再点击下一步

Eclipse:The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

我们在用Eclipse进行Java web开发时,可能会出现这样的错误:The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path.我们该怎么解决这个问题呢? 我们遇到的错误显示如下:  我们右击有错误提示的文件夹,如下:  我们点击"配置构建路径",如下:  我们再点击"添加库",如下:  我们选中上图中标出的选项,再点击下一步,如下:  我们再点击"

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

完整错误信息: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED.

eclipse JavaEE版"javax.servlet.http.HttpServlet" was not found on the Java Build Path问题的解决办法

使用eclipse JavaEE 版,新建 Dynamic Web Project 项目.在项目里添加 JSP 文件,会在文件头部出现错误提示.提示语句为:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path.如下图所示:       1. 选中项目右键打开快捷菜单. 2. 在快捷菜单中点击 Properties 打开对话框. 3. 在左边栏选择 Project Face

javax servlet-有谁知道javax.servlet.annotation.webservlet这个类是在哪个包

问题描述 有谁知道javax.servlet.annotation.webservlet这个类是在哪个包 有谁知道javax.servlet.annotation.webservlet这个类是在哪个包 解决方案 参考这个吧,是不是tomcat由7换成6了.http://blog.csdn.net/xw13106209/article/details/6025861 解决方案二: 应该是tomcat7.0里面lib下的annotations-api.jar 解决方案三: tomcat里面的lib中

eclipse 无法导入 import javax.servlet.http.HttpServlet

在eclipse中,编写servlet时,不能导入 HttpServlet 解决方法为:在build path中将 servlet-api.jar 导入即可.(servlet-api.jar在tomcat中的lib目录下) 点击项目 肯定是因为tomcat没有指定,系统无法自己找到.基本上指定一下就好了. 这里推荐使用方式,如果是版本很多不一致的情况下. 在设置中,把tomcat和jdk都指定清楚.

求问怎么解决?javax.servlet.ServletException

问题描述 求问怎么解决?javax.servlet.ServletException javax.servlet.ServletException: Could not resolve view with name 'employeeLog/emWorkLogDisplay' in servlet with name 'employeeLogManagement' org.springframework.web.servlet.DispatcherServlet.render(Dispatche

Eclipse javax.servlet.jsp.PageContext cannot be resolved to a type 错误解决办法

目前在jsp页面form action中使用${pageContext.request.contextPath }/servlet的写法,但是一直提示有错误,错误如下:javax.servlet.jsp.PageContext cannot be resolved to a type 网上解答过说要缺少jsp-api.jar,导入这个包之后不报错了,但是程序启动访问这个页面的时候出现如下错误: org.apache.jasper.JasperException: Unable to read T