URL-pattern in struts2 causes the problem that dojo is not defined.

Source: Internet
Author: User

When running the project today, the page suddenly reports the error "dojo undefined "! It's strange. It was okay yesterday. Why did this problem occur today? In <SCRIPT type = "text/JavaScript" scr = "/dojo. JS "> after specifying the path of the dojo library file, it still does not work. It is depressing. As a result, I searched the internet and found a renxiong had a problem similar to mine. I suddenly realized it after reading his explanation. It turns out that, like him, I changed some configuration in Web. xml at the end of yesterday. The original configuration is as follows:

<Filter>
<Filter-Name> struts2 </filter-Name>
<Filter-class>
Org. Apache. struts2.dispatcher. filterdispatcher
</Filter-class>
</Filter>

<Filter-mapping>
<Filter-Name> struts2 </filter-Name>
<URL-pattern>/* </url-pattern>
</Filter-mapping>

I changed it:

<Filter>
<Filter-Name> struts2 </filter-Name>
<Filter-class>
Org. Apache. struts2.dispatcher. filterdispatcher
</Filter-class>
</Filter>

<Filter-mapping>
<Filter-Name> struts2 </filter-Name>
<URL-pattern> *. Action </url-pattern>
</Filter-mapping>

<Filter-mapping>
<Filter-Name> struts2 </filter-Name>
<URL-pattern> *. jsp </url-pattern>
</Filter-mapping>

As a result, the. js file does not go through filterdispatcher. if you have a. CSS file in your project, it will also cause problems.

After finding the problem, I will continue to add it in the configuration file:

<Filter-mapping>
<Filter-Name> struts2 </filter-Name>
<URL-pattern>/struts/* </url-pattern>
</Filter-mapping>

After testing, everything is normal.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/gavin812428144/archive/2010/03/22/5405728.aspx

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.