-2

我在 java 中为我的 s/w 和使用 Struts2 的接口开发了一个后端。我从最后一个动作类调用 servlet 类并从那里运行我的业务逻辑,它被拆分为多个类。现在在代码中间,如果调用了特定方法,我需要接受用户输入。再次,其中一个输入是可选的(仅当我正在扫描的行中存在特定关键字时),如果调用该函数及之后,另一个是必需的接受输入,代码应该从左边的地方继续。代码不需要接受任何输入,如果函数没有被调用,应该继续。有人可以帮助我了解如何做到这一点的流程和基础知识。谢谢!

4

1 回答 1

0

An Action calling a Servlet ? The Action IS your "Servlet". You won't probably need Servlet anymore, except for rare cases.

To make it simple, the Action prepares the data for the view, then invokes the view (JSP, ore something else):

LoadDataToShowAction.java ========> dataToShow.jsp

in dataToShow.jsp, the user enters data, then clicks a button, invoking another Action:

dataToShow.jsp ========> ProcessUserDataAction.java

And so on.

Note that in the middle of the ========> part, there is the Interceptor Stack.

于 2013-10-15T23:11:24.367 回答