简体   繁体   English

Struts2的准备方法

[英]Struts2 prepare methods

I have one action class with different methods mapped for each action in my struts.xml. 我的struts.xml中有一个动作类,为每个动作映射了不同的方法。 And I want different prepare methods invoked before my other methods mapped in the struts.xml. 而且我希望在struts.xml中映射其他方法之前调用不同的prepare方法。

Simply create a 只需创建一个

void prepareMethodName(){}

Where MethodName is the name of your per-method Preparable method. 其中MethodName是每个方法可制备方法的名称。 The prepare() method by default will still run after this method is called. 默认情况下,prepare()方法在调用此方法后仍将运行。

Please see: http://struts.apache.org/2.0.14/docs/prepare-interceptor.html 请参阅: http : //struts.apache.org/2.0.14/docs/prepare-interceptor.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM