当客户访问Web应用时,如果仅仅给出Web应用的Root URL,没用指定具体的文件名,Web容器会自动调用Web应用的欢迎文件。 <welcome-file-list> <welcome-file>welcome.jsp</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-fiel-list> 说明:<welcome-file-list>可以包含多个<welcome-file>子元素,首先查找第一个<welcome-file>文件。 由于<welcome-file-list>元素中不能配置Servlet映射,因此不能直接把Structs的Action作为欢迎文件,可以采用一种变通的方法来实现在欢迎文件中调用Structs Action。首先,在Structs配置文件中为被调用的Action创建一个全局的转发项,例如: <global-forwards> <forward name=”welcome” path=”HelloWord.do”/> </global-forwords> 创建一个welcome.jsp的文件 最后在web.xml文件中把welcome.jsp文件配置为欢迎文件,代码如下: <welcome-file-list> <welcome-file>welcome.jsp</welcome-file> </welcome-file-list>
welcome-file-list
最新推荐文章于 2024-01-25 16:32:51 发布