• struts2与spring集成时action的class属性值意义


    struts2单独使用时action由struts2自己负责创建;与spring集成时,action实例由spring负责创建(依赖注入)。这导致在两种情况下struts.xml配置文件的略微差异。

    假如:LoginAction在包cn.edu.jlu.cs.action中。

    1. struts2单独使用时,action的class属性为LoginAction的全路径名,如下:

                   ...

    <action name="login" class="cn.edu.jlu.cs.action.LoginAction">

               <result name="studentSuccess">

                    /student/studentindex.jsp

               </result>

                   ...

    2. struts2与spring集成时,class属性是spring的applicationContext.xml中配置的bean的id属性值。

    ---------------------------------------------------------------------------------------

    //struts.xml

                   ...

    <action name="login" class="LoginAction">

               <result name="studentSuccess">

                    /student/studentindex.jsp

               </result>

                   ...

    ----------------------------------------------------------------------------------------

    //applicationContext.xml    或者在spring相应的配置文件中

                   ...

    <bean id="LoginAction" class="cn.edu.jlu.cs.action.LoginAction" />

  • 相关阅读:
    centos7 rabbitmq系统部署
    socket粘包、断包、校验
    C#对象、文件与二进制串(byte数组)之间的转换
    Windows Error Code
    C#之Socket断线和重连
    BitConverter 整数和十六进制互转
    DateTime还是DateTimeOffset?Now还是UtcNow?
    WebAPI 跨域
    Console Owin 跨域解决
    2019.12.17 Arcgis10.1许可到期解决方法
  • 原文地址:https://www.cnblogs.com/fanziyang/p/6106694.html
Copyright © 2020-2023  润新知