"SSH"--Add custom Interceptor Error: Probably due to a missing jar, which might is fine if you never the The xx__ interceptor

Source: Internet
Author: User

Detailed error message:

Unable to load config Class.cn.itcast.shop.interceptor.PrivilegeInterceptor at interceptor
file:/myeclipse/.xxx/web-inf/classes/struts.xml:13:102
Probably due to a missing jar, which might is fine if you never plan to use the Privilegeinterceptor interceptor about Jars Package

(1) The error message shows a missing jar package, and the following are all the jar packs that are configured by the Structs2.3.2 version.
Asm-3.3.jar
Asm-commons-3.3.jar
Asm-tree-3.3.jar
Commons-fileupload-1.3.1.jar about file Downloads
Commons-io-2.2.jar File Download
Commons-lang3-3.2.jar
Commons-loggin-1.1.3.jar Log Management
Freemarker-2.3.22.jar Presentation Layer framework, defines the Struts2 visual component theme
Javassist-3.11.0.ga.jar
Ognl-3.0.6.jar OGNL expression Language, Struts2 supports the El
Core Library of Strut2-core-2.3.24.1.jar Struts2
Xwork-core-2.3.24.1.jar WebWork's core library, Nature needs its support

Jar package must be complete, otherwise tomcat boot will have 500 error codes

(2) The following 6 are STRUCTS2 use the interceptor necessary jar pack, check that there is no less.
about Configuration

Registration information in Structs.xml:

<!--Configure Custom Interceptor-->
<interceptors>
        <interceptor name= "Privilegeinterceptor" class= Cn.itcast.shop.interceptor.PrivilegeInterceptor "/>
</interceptors>

<!--Configure the back-level category action- >
<action name= "admincategory_*" class= "admincategoryaction" method= "{1}" >
    <result name= " FindAll ">/admin/category/list.jsp</result>
  <!--reference Interceptor-->
    <interceptor-ref name=" Privilegeinterceptor "/>
    <interceptor-ref name= defaultstack"/>      
</action>   

The correct wording:

<!--in Spring Register Interceptor-->
<bean id= "Privilegeinterceptor" class= " Cn.itcast.shop.interceptor.PrivilegeInterceptor "scope=" prototype ">  
</bean>
<!--structs Configure custom interceptors-->
        <interceptors>
            <interceptor name= "Privilegeinterceptor" class= " Privilegeinterceptor "/>
        </interceptors>
Summary:

The lead jar package must be quoted. The implementation of the custom interceptor is not difficult to understand, we first wrote a Privilegeinterceptor class, and then because the SSH framework is used here, class creation is first given to spring management, So you can't register directly in Structs.xml, you should now register in spring.
Note that the IDs registered in spring correspond to the Name,class and name in structs and do not write the original path.

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.