使用Eclipse IDE创建第一个Servlet应用程序

Eclipse IDE is the most popular Java IDE used in the Industry. It is developed by an open source community and can be downloaded for free from Eclipse.org

Eclipse IDE是业界最流行的Java IDE。 它由开源社区开发,可以从Eclipse.org免费下载。

使用Eclipse IDE创建Servlet的步骤 (Steps to create Servlet using Eclipse IDE)

To create a Servlet application in Eclipse IDE you will need to follow the following steps:

要在Eclipse IDE中创建Servlet应用程序,您将需要执行以下步骤:

  1. Goto File -> New -> Dynamic Web Project

    转到文件 -> 新建 -> 动态Web项目

    steps to create servlet application in eclipse
  2. Give a Name to your Project and click Next

    为您的项目命名,然后单击下一步

    steps to create servlet application in eclipse


    steps to create servlet application in eclipse
  3. Check Generate web.xml Deployment Descriptor and click Finish

    选中“ 生成web.xml部署描述符” ,然后单击“ 完成”。

    steps to create servlet application in eclipse
  4. Now, the complete directory structure of your Project will be automatically created by Eclipse IDE.

    现在,您的项目的完整目录结构将由Eclipse IDE自动创建。

    steps to create servlet application in eclipse
  5. Click on First project, go to Java Resources -> src. Right click on src select New -> Servlet

    单击第一个项目,转到Java资源 -> src 。 右键单击src选择New- > Servlet

    steps to create servlet application in eclipse
  6. Give Servlet class name and click Next

    输入Servlet类名称,然后单击Next。

    steps to create servlet application in eclipse
  7. Give your Servlet class a Nmae of your choice.

    为您的Servlet类选择一个Nmae。

    steps to create servlet application in eclipse
  8. Leave everything else to default and click Finish

    将其他所有内容保留为默认值,然后单击完成

    steps to create servlet application in eclipse
  9. Now your Servlet is created, write some code inside it. You can take reference from the code in the picture below.

    现在,您的Servlet已创建,在其中编写一些代码。 您可以从下图中的代码中获取参考。

    steps to create servlet application in eclipse
  10. Add servlet-api.jar JAR file to your project. Click on Libraries, right click on Web App Libraries select Build Path -> Configure Build Path

    servlet-api.jar JAR文件添加到您的项目中。 单击 ,右键单击Web App库,选择构建路径 -> 配置构建路径

    steps to create servlet application in eclipse
  11. Click on Add External JARs

    单击添加外部JAR

    steps to create servlet application in eclipse
  12. This JAR is now added to your project's build path.

    现在,此JAR已添加到项目的构建路径中。

  13. Select servlet-api.jar from Apache Tomcat Directory

    Apache Tomcat目录中选择servlet-api.jar

    steps to create servlet application in eclipse


    steps to create servlet application in eclipse
  14. Now all you have to do is Start the server and run the application.

    现在,您要做的就是启动服务器并运行应用程序。

    steps to create servlet application in eclipse

翻译自: https://www.studytonight.com/servlet/creating-servlet-in-eclipse.php

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值