1.在Eclipse中创建Dynamic Web Project.
2.一路next,在“Configure web module settings.”中勾选Generate web.xml deployment descriptor选项,在WebContent/WEB-INF目录中,生成web.xml
3.随便拷贝一个index.htm文件,放在WebContent,作为welcome-file,用于展示启动页
4.web.xml中servlet和servlet-mapping标签,要注意写对;两个标签中的子标签值<servlet-name>必须相同
5.子类重写doGet或doPost等方法,即去掉super.doGet(request, response)和super.doPost(request, response)
本文详细介绍了如何在Eclipse中创建DynamicWebProject,包括设置web模块、生成web.xml部署描述符、配置welcome-file以及正确编写servlet和servlet-mapping标签的方法。
1364

被折叠的 条评论
为什么被折叠?



