eclipse wtp 没有自动生成 web.xml
因此,运行servlet 时出错了。
网上查了一下,好像说确实不会自动生成,但是运行应该没有问题的。
幸亏找到了手动生成web.xml的方法,也就不纠结了。
http://crunchify.com/eclipse-missing-web-xml-file-how-can-i-create-web-xml-in-eclipse/
Eclipse: Missing web.xml file? How can I create web.xml in Eclipse?
SHORT LINK:
Last Updated on March 3rd, 2016 by App Shah 12 Comments
Have you created Dynamic Web Project and created servlet and still are you missing web.xml
file under\WebContent\WEB-INF\
..?
Eclipse allows you to NOT create a web.xml file when you create Dynamic Web Project for Java EE 6, since the Java EE 6 spec (in general) and Servlet 3.0 spec (in particular) attempt to de-emphasize deployment descriptors.
You can use annotation to provide all the data that had been included in the web.xml file. You should read through the Servlet 3.0 spec from the jcp.org site to get a bit more explanatory text.
To change the url-mapping for a Servlet 3.0 servlet, the first place to look is in the source code for the servlet. Look for (and change) the value of the urlPatterns element.
If you are trying to create a web app based on Servlet 3.0, try to avoid creating a web.xml file.
But still if you need web.xml
then you can do it by
- Dynamic Web Project
- Right Click
- Java EE Tools
- Generate Deployment Descriptor Stub
You should see web.xml
file immediately after that.
eclipse wtp 没有自动生成 web.xml的更多相关文章
- 用Eclipse新建一个web项目没有自动生成web.xml
我们首先打开Eclipse,如下: 我们可以看到在"WEB-INF"文件夹下没有web.xml文件. 这是是什么原因呢,我们来看看,我们首先来新建一个web工程,如下: ...
- 新建web project不自动生成web.xml解决方案
一步一步建立Web Project ,第3步会有 “Generate Web.xml deployment descriptor”,默认没勾选,勾上就行了
- Maven自动生成web.xml配置文件
没有这个文件会报错误的: 1. 2.在Maven下面设置这个: src/main/webapp OK生成了
- eclipse 自动创建web.xml
eclipse 自动创建web.xml 以前每次创建web项目的时候,总是从其他的项目中拷贝一个web.xml文件到新项目,然后改吧改吧就可以了,但是这终究是一件麻烦的事,要是能够通过软件自动创建,那 ...
- 用eclipse创建动态web项目手动生成web.xml方法
建一个web项目,后来在用到web.xml文件时,才发现项目创建时没有自动创建web.xml文件. 在创建的项目上单击右键,然后单击java EE Tools下的用红线圈住的地方,然后查看你的WEB- ...
- Eclipse建立Web项目,手动生成web.xml文件
相关文章:https://blog.csdn.net/ys_code/article/details/79156188(Web项目建立,手动生成web.xml文件
- 利用Eclipse的JPA自动生成注解实体
新公司用的SSH(springmvc)框架,看代码的时候,发现没有hbm.xml文件,全部使用的注解形式.在一次闲聊的时候问同事,这么多entity 写起来不麻烦么.同事说根据数据库自动生成的.于是 ...
- java如何在eclipse编译时自动生成代码
用eclipse写java代码,自动编译时,如何能够触发一个动作,这个动作是生成本项目的代码,并且编译完成后,自动生成的代码也编译好了, java编辑器中就可以做到对新生成的代码的自动提示? 不生成代 ...
- eclipse中如何自动生成构造函数
eclipse中如何自动生成构造函数 eclipse是一个非常好的IDE,我在写java程序的时候使用eclipse感觉开发效率很高.而且有很多的快捷和简便方式供大家使用,并且能直接生成class文件 ...
随机推荐
- 187. Repeated DNA Sequences(建立词典,遍历一遍 o(n))
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
- MAX_STATEMENT_TIME uses confusing syntax
From https://bugs.mysql.com/bug.php?id=72540 [5 May 2014 18:46] Morgan Tocker Description: Via C ...
- SpringBoot之RESTFul风格的接口调用(jQuery-Ajax)
一.Get $.ajax({ type: "get", url: "url地址", async: true, dataType:"json" ...
- 深入浅出JavaScript运行机制
一.引子 本文介绍JavaScript运行机制,这一部分比较抽象,我们先从一道面试题入手: console.log(1); setTimeout(function(){ console.log(3); ...
- Nodejs 实现 WebSocket 太容易了吧!!
我们基于express和socket.io开发,首先我们需要安装以下包 npm install --save express npm install --save socket.io 服务器端代码: ...
- payload
payload就是协议报文中的有效载荷所占报文的百分比,用报文中去除协议的长度/报文总长度,协议设计的时候需要考虑到有效载荷所占的比重,避免出现payload很小的情况,比如TCP在设计的时候,就考虑 ...
- bzoj 1010 玩具装箱toy -斜率优化
P教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京.他使用自己的压缩器进行压缩,其可以将任意物品变成一堆,再放到一种特殊的一维容器中.P教授有编号为1...N的N件玩具,第i件玩具 ...
- C++ vector 删除一个指定元素 和 find 一个指定元素以及遍历删除、 map遍历删除元素和删除find到的元素
vector: 1.delete element 转载:http://www.cnblogs.com/xudong-bupt/p/3522457.html #include <vector> ...
- redhat 7.2更新yum源时踩的坑
一.update yum .先查看redhat7.2中yum的包版本 [root@localhost jiayimeng]# rpm -qa | grep yum -.el7.noarch -.el7 ...
- Adobe Reader 2019 Offline Installer, Free Download - Best PDF Reader
https://ridnt-b.blogspot.com/2018/01/adobe-reader-2018-free-download.html http://ardownload.adobe.co ...