在Myeclipse开发环境下建立Servelet是很方便的,自动提供Servelet源程序结构框架,自动配置Servelet,自动部署。java
首先创建一个web 工程。使用Myeclipse开发工具创建WEB工程时,会自动在WebRoot、WEB-INF目录下建立配置文件Web.xml。该文件配置了启动WEB工程时须要服务器设置的一些初始信息。web
<?xml version="1.0"encoding="utf-8"?>服务器
<web -app version="2.5"app
xmlns=“http://java.sun.com/xml/ns/javaee” 框架
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"eclipse
xsi:schemaLocation="http://java.sun.com/xml/ns/javaeejsp
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd>ide
<welcome-file_list>工具
<welcome_file>index.jsp</welcome-file>开发工具
</welcome-file-list>
</web-app>
说明:
对于web.xml中的配置的默认的主页名称:index.jsp,其做用是当客户端请求进入该项目的主页时
采用以下格式:
htttp://IP 地址:8080/工程名称/index.jsp