在 Struts2 中调用多个方法

Calling multiple methods in Struts2

我有一个 LoginAction class,其中我有三种方法 execute()read()write()。在执行方法中,我调用 readwrit 方法使用:

LoginAction l1 = new LoginAction();l1.read();l1.write(null);
execute file-----upload file from directory.
read and write------------read uploaded file and convert it into excel.

在我的 struts.xml 中,我编写了调用这些方法的步骤。

 action name="login" class="net.myapp.struts.LoginAction"
 method="execute" 

但在 运行 时只有一种方法(execute 方法)有效。如何调用所有方法?

我的方法是:

public String execute() throws Exception
boolean write(List<String> l1) throws Exception
public String Read() throws Exception
form tag. s:form action="login1" method="post" enctype="multipart/form-data"
        namespace="/".

为此,我们可以在 Struts 中使用链接 2. 一个动作导致另一个动作,依此类推。 请求 > 操作 1 > 操作 2 > 操作 3 > 响应。 http://viralpatel.net/blogs/struts-2-action-chaining-example/