Invoking methods in Action

情到浓时终转凉″ 提交于 2019-12-23 01:18:41

问题


I'm working on Struts web based application where I have created an action class with multiple methods in it. I invoke these methods based on the kind of task I want the application to perform. Could someone please tell me if I should use this technique to do so?

Should I continue invoking the methods like I am or should I create separate action classes for every different action I want to perform?


回答1:


One action class can have many actions, many methods, but you should map only one method to the action.

Also note: in the recent releases DMI (Dynamic Method Invocation) is turned off by default and might not work in the future.

It's unclear how do you invoke methods, some interceptors still evolve a method filtering, where you can restrict some methods. But there's no restriction to map different actions in the same action class. And there's no restriction to invoke any action class' method on the view layer.

Also the action that is mapped to the method can invoke any other methods directly or via reflection.



来源:https://stackoverflow.com/questions/28276191/invoking-methods-in-action

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!