关于web程序的发布
必须依赖于IDE集成Tomcat吗,能不能手动发布?
我将Tomcat的lib直接拿到Java工程中使用了,但是写好后,发现没有web.xml。
请问web.xml是IDE按照Tomcat识别规则自动生成的文件吗。
如果手动发布web程序,是不是要自己按照建立一个web.xml和相应的目录结构,最后打包成JAR包并放到webapps目录下?
57
收起
正在回答 回答被采纳积分+1
5回答
易萧
2020-09-03 11:18:27
以下是我手动创建的目录结构,除了class是编译的之外,其它文件也是手动编写。
其中,JavaWebDemo是我的项目目录。
以下是xml文件内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <? xml version = "1.0" encoding = "UTF-8" ?> < web-app xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns = "http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation = "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id = "WebApp_ID" version = "4.0" > < display-name >JavaWebDemo</ display-name > < welcome-file-list > < welcome-file >index.html</ welcome-file > < welcome-file >index.htm</ welcome-file > < welcome-file >index.jsp</ welcome-file > < welcome-file >default.html</ welcome-file > < welcome-file >default.htm</ welcome-file > < welcome-file >default.jsp</ welcome-file > </ welcome-file-list > < servlet > < servlet-name >first</ servlet-name > < servlet-class >com.yixiao.servlet.FirstServlet< servlet-class > </ servlet > < servlet-mapping > < servlet-name >first</ servlet-name > < url-pattern >/theUrlName</ url-pattern > </ servlet-mapping > </ web-app > |
java工程师2020版
- 参与学习 人
- 提交作业 9403 份
- 解答问题 16556 个
综合就业常年第一,编程排行常年霸榜,无需脱产即可学习,北上广深月薪过万 无论你是未就业的学生还是想转行的在职人员,不需要基础,只要你有梦想,想高薪
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧