Struts2 setting Index.action for Home page (also: Web. XML edit card Dead problem resolved)

Source: Internet
Author: User

It was the problem of the interceptor, the result of the home page, still found the problem.

The company website project inside, is uses index.action as the homepage, accesses the Web-inf inside the HTML file. But I set but not successful, traced in the end, a reason, struts2 more special, struts.xml inside must configure a request and response.

<?XML version= "1.0" encoding= "UTF-8"?><Web-appID= "Webapp_9"version= "3.0"xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd">    <Display-name>Struts Blank</Display-name>    <Filter>        <Filter-name>Struts2</Filter-name>        <Filter-class>Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</Filter-class>    </Filter>    <filter-mapping>        <Filter-name>Struts2</Filter-name>        <Url-pattern>/*</Url-pattern>                <Dispatcher>REQUEST</Dispatcher>         <Dispatcher>FORWARD</Dispatcher>      </filter-mapping>     <welcome-file-list>        <Welcome-file>Index.action</Welcome-file>    </welcome-file-list></Web-app>

This makes it easy to use index.action as your home page.

In addition to this configuration, you can also use JSP inside add forward to jump to index.action as the home page. You can also use HTML to add a <meta> tag refresh to jump to the page action inside.

Without request and response, you can only use HTML plus <meta> tags.

Another: Eclipse edit Web. xml, always stuck, because of the problem of the version of the header, the version of the number to be consistent.

<?XML version= "1.0" encoding= "UTF-8"?><Web-appID= "Webapp_9"version= "3.0"xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_3_0.xsd">

The

, as above, is 3.0.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.