Home > Back-end >  How can spring MVC in the ear project start time of the year, is automatically loaded a method, a cl
How can spring MVC in the ear project start time of the year, is automatically loaded a method, a cl

Time:09-16

Original struts struts within one - config. XML



-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
InitPlugin. Java
package jp. Sales. Oio. Oiobama. Core;

Import the Java. IO. InputStream;

The import javax.mail. Servlet. ServletException;

The import org. Apache. Struts. The action. The ActionServlet;
The import org. Apache. Struts. The action. The PlugIn;
The import org. Apache. Struts. Config. ModuleConfig;

The import com. IBM. Jp. Ams. View the core. Global. CoreConstants;
Import com. IBM. Jp. Ams. View the core, logging, that the LogManager;
Import com. IBM. Jp. Ams. View the core, logging, Logger;
The import com. IBM. Jp. Ams. Web. Navigationsupport. Digester. NavigationDigester;
The import com. IBM. Jp. Ams. Web. Navigationsupport. Digester. RolesDigester;
The import com. IBM. Jp. Ams. Web. Navigationsupport. Entity. Navigation;
The import com. IBM. Jp. Ams. Web. Navigationsupport. Entity. Roles;

Public class InitPlugin implements the PlugIn {

Private ActionServlet servlet=null;

/* ロ グ definition XML フ ァ イ ル name */
Private String log4jConfig=null;
/* the properties said said the ACL */
//private String propertiesAcl=null;

/* ナ ビ ゲ ー シ ョ ン definition XML フ ァ イ ル name */
Private String sideNaviConfig=null;

Private String roleConfig=null;

/* *
*

The Log Manager


*/
Private Logger Logger=Logger. GetLogger (InitPlugin. Class);

/* *
* Initial 処 Richard を line be し ま す, & lt; br/>
*
* @ see PlugIn# init (ActionServlet, ModuleConfig)
*/
Public void init (ActionServlet ActionServlet, ModuleConfig ModuleConfig) throws ServletException {
Enclosing the servlet=actionServlet;
Try {
//ロ グ マ ネ ー ジ ャ ー initialize
InitLogManager ();
//サ イ ド ナ ビ フ ァ イ ル 読 み 込 み
InitNavigater ();
//Role definition 読 み 込 み
InitRole ();
//PropertiesAccessControl init
//initPropertiesACL ();
} the catch (Exception e) {
Throw new ServletException (e);
}
}

/* *
* ロ グ マ ネ ー ジ ャ ー の early change line 処 reason を い ま す,
* @ throws the Exception
*/
Private void initLogManager () throws the Exception {
That the LogManager. Init (log4jConfig);
}


By the struts - config. XML defined plug-in in inside, such as the project starts, automatic loading a class such as "jp. Sales. Oio. Oiobama. Core. InitPlugin, this InitPlugin class inherits the import org, apache struts. The action. The PlugIn; so I think the InitPlugin class public void init (ActionServlet ActionServlet, ModuleConfig ModuleConfig) throws ServletException is automatically loaded,


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Ask a question, the struts 1.1 project to spring MVC now
Spring MVC is there a similar way,
Spring MVC can automatically call when I was in a project to start the a class (Controller) one way,

Why have this requirement, because my client. Invokes the Java server-side webservice.net application requirements, and the inside of the webservice the called method will use this InitPlugin an instance of a class,
If the InitPlugin class in the interceptor is initialized is very normal, but the client calls webservice way when I was in trouble, the client can't wait server-side user login web, enabling interceptors, and then enable the class ah,

Somebody help me,

Look at the spring - the MVC. I wrote XML

<? The XML version="1.0" encoding="utf-8"?>
XMLNS: xsi="http://www.w3.org/2001/XMLSchema-instance"
XMLNS: context="http://www.springframework.org/schema/context"
XMLNS: MVC="http://www.springframework.org/schema/mvc"
Xsi: schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd "& gt;










  • Related