Web.xml and struts on the front page of the action in question

2011-04-28  来源:本站原创  分类:Java  人气:134 

wel.xml is this configuration:

<welcome-file-list>
        <welcome-file>index.action</welcome-file>
</welcome-file-list>

struts is this configuration:

<action name="index" >
            <result type="redirectAction">index_view</result>
        </action>
        <action name="index_*" method="{1}">
                <result name="success" >/template/index.ftl</result>
        </action>

So I began thinking that, when access to the project's URL, (http://127.0.0.1:8080/test/), tomcat web.xml in welcome based on the configuration files automatically added after the URL index.action. Struts and this url will be blocked, it will be turned IndexAction, eventually turning index.ftl file.

But actually, such a configuration will not find the error reporting resources.

The solution is to create a root directory index.action (with the same welcome page in web.xml) file. Why is wet like this it?

Web.xml for tomcat load, it will find the welcome page configuration exists, there is an error. Note that the URL is requested at this time does not. The above situation is that when tomcat find index.action this file is not found, so the error was. So there is no request url. And when in the root directory plus a index.action, because to find the file, it will not error. Tomcat continue loading other files and then, when the document finished loading, the start request the URL (http://127.0.0.1:8080/test/index.action), in order to open the welcome page. When requesting the URL, the URL is blocked struts, steering action treatment, which index.action file not be opened. Therefore, no matter what index.action fill are not displayed.

In addition, according to the configuration of web.xml, struts will block all of the URL, so the suffix is ​​either index.action action or something else, can turn to the index of the action. One fact is not the case, why?

Because there is this struts.xml struts.action.extension, set the action to deal with the struts.

Can generally be set to this:

<constant name="struts.action.extension" value="do,action" />

If you do not set it to default action. So the example above, only the suffix configured for you when the suffix struts.action.extension success.

相关文章
  • Web.xml and struts on the front page of the action in question 2011-04-28

    wel.xml is this configuration: <welcome-file-list> <welcome-file>index.action</welcome-file> </welcome-file-list> struts is this configuration: <action name="index" > <result type="redirectAction">in

  • Tomcat Web application using web.xml control Xiangjie (2) 2010-07-30

    Tomcat Web application using web.xml control Xiangjie (2) Study: feng_sundy Source: unknown (2006-04-29 13:42:24) 7 specified welcome page If the user provides a http://host/webAppPrefix/directoryName/ such as a directory name that contains the file

  • web.xml configuration details 2010-11-12

    1 defines the root element of the head and Deployment descriptor file like all XML files, an XML header must begin. The first statement can use the XML version and character encoding the file is given. DOCYTPE declaration must appear immediately afte

  • Struts2.0 configuration file (web.xml) 2010-04-19

    web.xml is the web application loads the important information about servlet configuration file, play initialization servlet, filter, etc. The role of web programs. In general, all of the MVC framework for Web applications need to load a core control

  • Xiang Jie Struts configuration file, web.xml and struts-cofig.xml, as well as the struts-cofig.xml in the role of the various labels 2010-04-19

    Struts applications use two XML-based configuration files to configure, respectively web.xml and struts-cofig.xml file. Web.xml file is the configuration for all web applications, while the struts-config.xml file is struts-specific configuration file

  • web.xml in the load-on-startup tag meaning and application of struts jstl 2009-09-10

    Among the servlet configuration ,<load-on-startup>5</load-on-startup> Mean : Tag container is in the started loading this servlet. Where a value of 0 or greater than 0 Represents a container when the application starts the load servlet: When i

  • Web.xml file configuration Struts project 2010-12-30

    Reprinted (http://blog.csdn.net/songqiu/archive/2007/09/08/1776880.aspx) web.xml file for Java Web applications to configure any necessary. (1) Configure the ActionServlet Struts element to declare the ActionServlet <servlet> <servlet-name> el

  • spring in the web.xml and in the struts of different configurations 2010-04-25

    When I first came to this company for nearly half a month, looked at 10 years of experience developed in java to write the ssh master frame, feel and their own at school and really do not like this is really the framework of E Haha ssh Hugong a begin

  • (Transfer) web.xml configuration 404 and 500 custom error page 2010-08-17

    web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://

  • JSP page error handling in web.xml to achieve production of 404, and 500 2010-12-03

    Add the following code in web.xml file copied to the clipboard Print View <error-page> <error-code> 404 </ error-code> <location> / building.jsp </ location> </ Error-page> <error-page> <error-code> 500 <

  • struts中web.xml配置和修改工程名 2012-08-21

    在myeclipse中工程名不能随便修改,因为修改后可能tomcat中的工程名没有修改,运行时总是显示找不到文件.出现该问题就直接到tomcat的目录D:\work\download\apache-tomcat-6.0.35\webapps下面找到相应工程名进行修改. 在配置struts的web.xml文件时直接复制strusts D:\My Documents\Downloads\struts-2.3.4.1-all\struts-2.3.4.1\apps里面的struts2-blank.wa

  • web.xml configuration file Xiangjie 2010-04-19

    Deployment descriptor is actually an XML file that contains a lot of description of servlet / JSP applications in all aspects of the elements, such as the servlet registration , Servlet mapping as well as the listener registration. The deployment des

  • web.xml, listener, filter, Servlet load order 2010-03-29

    In the project will always encounter some problems on the priority of loading, also recently encountered a similar, and they therefore find the information summarized, the following are reproduced some other people, after all, the good people to writ

  • web.xml in the listener. filter.servlet loading order and Xiang Jie (2) 2010-06-21

    In the project will always encounter some problems on the priority of loading, also recently encountered a similar, and they therefore find the information summarized, the following are reproduced some other people, after all, the good people to writ

  • increase in the listener filter servlet web.xml cut order 2010-10-16

    1. First, be sure to load the order with their order in the web.xml file has nothing to do. That will not filter written in front of the listener will first load the filter. The final conclusion is: listener -> filter -> servlet There is also a sect

  • web.xml in the listener. filter.servlet loading sequence and its Detailed (rpm) 2010-10-27

    I. 1, the start of a project when WEB, WEB container to read its configuration file web.xml, read <listener> and <context-param> two nodes. 2, the emergency was, capacity to create a ServletContext (servlet context), all parts of the web proje

  • web.xml in the listener. filter.servlet loading order and Detailed 2010-11-28

    I. 1, the start of a project when WEB, WEB container to read its configuration file web.xml, read <listener> and <context-param> two nodes. 2, the emergency was, capacity to create a ServletContext (servlet context), all parts of the web proje

  • Server startup in the web.xml configuration Webapp load order 2011-08-19

    A 1, when the project started a WEB, WEB container to read its configuration file web.xml, and read <listener> <context-param> two nodes. 2, the emergency was, content to create a ServletContext (servlet context), all parts of this web project

  • web.xml in the listener. filter.servlet load order and Detailed 2011-10-09

    <! - Body start -> the web.xml listener, filter, servlet load order and Detailed I. Overview 1, when the project started a WEB, WEB container to read its configuration file web.xml, and read <listener> <context-param> two nodes. 2, with

  • web.xml configuration and description (switch set) 2009-05-02

    I'll own know the elements of web.xml compiled this: web.xml The first is sure to include its schema. <web-app xmlns = "http://java.sun.com/xml/ns/j2ee" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation =