1. 打开Eclipse,单击“Window”菜单,选择下方的“Preferences”。
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  2. 单击“Server”选项,选择下方的“Runtime Environments”。
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  3. 点击“Add”添加Tomcat。
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  4. 点击“Next”,选中自己安装的Tomcat路径。
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  5. 点击“Finish”完成。
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun

建立一个Web应用

  1. FileNewDynamic Web Project
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  2. 创建一个Dynamic Web Project
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  3. 点击“Next”下一步
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  4. 点击“Next”下一步
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  5. 点击“Finish”完成
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun

让Tomcat服务器显示在控制台上,将Web应用部署到Tomcat中

  1. WindowShow ViewServers
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  2. 点击链接No servers are available. Click ths link to create a new server. ,在弹出的对话框中选择Tomcat版本
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
  3. 点击“Next”,添加我们的项目
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
    选中项目并点击Add,或是双击都可以添加到右边
  4. 点击“Finish”完成
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun

    返回下方的“Servers”面板,右键单击该面板中的“Tomcat v8.0 Server at localhost”节点,在弹出的快捷菜单中单击“Start”,即可启动指定的Web服务器。如果此时直接启动访问http://localhost:8080/TomcatTest ,会发现会报404的错误。这是因为我们没有添加主页,下面添加主页(index.jsp)的内容:

    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>欢迎页面</title>
    </head>
    <body>
    欢迎使用eclipse部署Tomcat。
    </body>
    </html>
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    注意:web资源一定要在WebRoot目录下添加。如图:
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun
    此时,再一次来访问该链接:http://localhost:8080/TomcatTest ,效果如下:
    (转载)(DescriptionResource	Path	Location	Type The superclass "javax.servlet.http.HttpServlet" was not foun

相关文章:

  • 2021-10-04
  • 2021-04-17
  • 2021-11-22
猜你喜欢
  • 2021-08-22
  • 2021-05-01
  • 2021-04-05
  • 2021-07-03
相关资源
相似解决方案