编译beans时,出现"包 javax.servlet 不存在"错误提示,请问怎样解决???

时间:2022-12-30 23:51:51
在编译beans时,出现"包 javax.servlet 不存在","包 javax.servlet.http不存在"的错误提示。请问这两个软件包是不是存在jdk里?为什么会出现这种问题?怎样解决???各位帮帮忙呀,我刚学jsp不久的,别再让问题打击我这弱小的心灵!

4 个解决方案

#1


jdk中没有,如果你有tomcat有tomcat/lib/servlet中有,那你在classpath设置一下呀

#2


赞同楼上的!
这里有很多相关的问题,你搜索一下!会找到很多。

你需要在CLASSPATH中指明javax.servlet包。
你用什么服务器?我的tomcat是3.2.1版本,我的servlet路径设的为:
E:\TOMCAT\lib\servlet.jar; 

servlet.jar包含的类有:

META-INF/
META-INF/MANIFEST.MF
javax/
javax/servlet/
javax/servlet/http/
javax/servlet/jsp/
javax/servlet/jsp/tagext/
javax/servlet/http/Cookie.class
javax/servlet/http/HttpServlet.class
javax/servlet/http/NoBodyResponse.class
javax/servlet/http/NoBodyOutputStream.class
javax/servlet/http/HttpServletRequest.class
javax/servlet/http/HttpServletResponse.class
javax/servlet/http/HttpSession.class
javax/servlet/http/HttpSessionBindingEvent.class
javax/servlet/http/HttpSessionBindingListener.class
javax/servlet/http/HttpSessionContext.class
javax/servlet/http/HttpUtils.class
javax/servlet/http/LocalStrings.properties
javax/servlet/http/LocalStrings_es.properties
javax/servlet/jsp/tagext/BodyContent.class
javax/servlet/jsp/tagext/BodyTag.class
javax/servlet/jsp/tagext/BodyTagSupport.class
javax/servlet/jsp/tagext/Tag.class
javax/servlet/jsp/tagext/TagAttributeInfo.class
javax/servlet/jsp/tagext/TagData.class
javax/servlet/jsp/tagext/TagExtraInfo.class
javax/servlet/jsp/tagext/TagInfo.class
javax/servlet/jsp/tagext/TagLibraryInfo.class
javax/servlet/jsp/tagext/TagSupport.class
javax/servlet/jsp/tagext/VariableInfo.class
javax/servlet/jsp/HttpJspPage.class
javax/servlet/jsp/JspEngineInfo.class
javax/servlet/jsp/JspException.class
javax/servlet/jsp/JspFactory.class
javax/servlet/jsp/JspPage.class
javax/servlet/jsp/JspTagException.class
javax/servlet/jsp/JspWriter.class
javax/servlet/jsp/PageContext.class
javax/servlet/GenericServlet.class
javax/servlet/RequestDispatcher.class
javax/servlet/Servlet.class
javax/servlet/ServletConfig.class
javax/servlet/ServletContext.class
javax/servlet/ServletException.class
javax/servlet/ServletInputStream.class
javax/servlet/ServletOutputStream.class
javax/servlet/ServletRequest.class
javax/servlet/ServletResponse.class
javax/servlet/SingleThreadModel.class
javax/servlet/UnavailableException.class
javax/servlet/LocalStrings.properties 

#3


把以下包加到CLASSPATH中就可以了!
c:\tomcat\lib\ant.jar;
c:\tomcat\lib\jasper.jar;
c:\tomcat\lib\jaxp.jar;
c:\tomcat\lib\parser.jar;
c:\tomcat\lib\servlet.jar;
c:\tomcat\lib\webserver.jar;

#4


谢谢你们!!!

#1


jdk中没有,如果你有tomcat有tomcat/lib/servlet中有,那你在classpath设置一下呀

#2


赞同楼上的!
这里有很多相关的问题,你搜索一下!会找到很多。

你需要在CLASSPATH中指明javax.servlet包。
你用什么服务器?我的tomcat是3.2.1版本,我的servlet路径设的为:
E:\TOMCAT\lib\servlet.jar; 

servlet.jar包含的类有:

META-INF/
META-INF/MANIFEST.MF
javax/
javax/servlet/
javax/servlet/http/
javax/servlet/jsp/
javax/servlet/jsp/tagext/
javax/servlet/http/Cookie.class
javax/servlet/http/HttpServlet.class
javax/servlet/http/NoBodyResponse.class
javax/servlet/http/NoBodyOutputStream.class
javax/servlet/http/HttpServletRequest.class
javax/servlet/http/HttpServletResponse.class
javax/servlet/http/HttpSession.class
javax/servlet/http/HttpSessionBindingEvent.class
javax/servlet/http/HttpSessionBindingListener.class
javax/servlet/http/HttpSessionContext.class
javax/servlet/http/HttpUtils.class
javax/servlet/http/LocalStrings.properties
javax/servlet/http/LocalStrings_es.properties
javax/servlet/jsp/tagext/BodyContent.class
javax/servlet/jsp/tagext/BodyTag.class
javax/servlet/jsp/tagext/BodyTagSupport.class
javax/servlet/jsp/tagext/Tag.class
javax/servlet/jsp/tagext/TagAttributeInfo.class
javax/servlet/jsp/tagext/TagData.class
javax/servlet/jsp/tagext/TagExtraInfo.class
javax/servlet/jsp/tagext/TagInfo.class
javax/servlet/jsp/tagext/TagLibraryInfo.class
javax/servlet/jsp/tagext/TagSupport.class
javax/servlet/jsp/tagext/VariableInfo.class
javax/servlet/jsp/HttpJspPage.class
javax/servlet/jsp/JspEngineInfo.class
javax/servlet/jsp/JspException.class
javax/servlet/jsp/JspFactory.class
javax/servlet/jsp/JspPage.class
javax/servlet/jsp/JspTagException.class
javax/servlet/jsp/JspWriter.class
javax/servlet/jsp/PageContext.class
javax/servlet/GenericServlet.class
javax/servlet/RequestDispatcher.class
javax/servlet/Servlet.class
javax/servlet/ServletConfig.class
javax/servlet/ServletContext.class
javax/servlet/ServletException.class
javax/servlet/ServletInputStream.class
javax/servlet/ServletOutputStream.class
javax/servlet/ServletRequest.class
javax/servlet/ServletResponse.class
javax/servlet/SingleThreadModel.class
javax/servlet/UnavailableException.class
javax/servlet/LocalStrings.properties 

#3


把以下包加到CLASSPATH中就可以了!
c:\tomcat\lib\ant.jar;
c:\tomcat\lib\jasper.jar;
c:\tomcat\lib\jaxp.jar;
c:\tomcat\lib\parser.jar;
c:\tomcat\lib\servlet.jar;
c:\tomcat\lib\webserver.jar;

#4


谢谢你们!!!