The code contains a few Struts action classes and a couple of JSPs.
代码包含少量Struts动作类和两个jsp页面。
This is a default parameter name for all Struts action and cannot be changed.
这是所有Struts行为默认的参数名称,不能更改。
When a Struts action takes place, its action class passes data to the property broker.
当一个Struts行为发生以后,它的行为类就会将数据传递给这个属性代理。
That is, an HTTP request started in a Struts action can actually go into an EJB session bean.
也就是说,HTTP请求开始于一个Struts动作,然后延续到一个EJB会话bean。
Listing 1 shows an example of a Struts Action that blurs the line between model and controller.
清单1显示了一个Struts Action的例子,这个例子模糊了模型层和控制器层之间的界线。
Listing 1 and Listing 2 illustrate a typical Struts action and a typical Rails action, respectively.
清单1和清单2分别演示了典型的Struts动作和典型的Rails动作。
In Listing 5, AnyAction represents any Struts action; it shows how you can get an object from the object manager.
在清单5中,AnyAction代表任何Struts动作;它演示如何从对象管理器获取对象。
A Struts action is an instance of an action class that implements a portion of a Web application and returns an object.
Struts动作是action类的一个实例,action类实现Web应用程序的portion并返回对象。
The only real servlet in this example is the Struts action servlet, which controls the invocation of the action classes.
这个示例中唯一一个真正的servlet是Struts动作servlet,它控制动作类的调用。
A Struts action is an instance of an action class subclass that implements a portion of a Web application and returns a forward.
Struts操作是Action类子类的实例,用来实现一部分Web应用程序并返回一个转发。
While no one would have thought it at the time (ah, the freewheeling days of yore), Struts Action classes often become havens for complexity.
虽然在那个时候(过去的自由时光啊)可能没人想过,但Struts Action类通常成为复杂性的保护所。
Directly Remove Sol demonstrates handling a transaction in the Web tier by obtaining a UserTransaction instance and using it within the Struts action.
DirectlyRemoveSol通过获得一个UserTransaction实例并且在Struts动作中使用它来演示在web层中处理一个事务。
However, we want to write the action in a scripting language, so we will use the ScriptedAction class, which extends the Struts action to execute a script.
不过,我们希望使用脚本语言编写操作,因此,我们将使用scriptedaction类,该类会对Struts Action进行扩展以执行脚本。
Next, in the Struts configuration file (WEB-INF\struts-config.xml), the Struts action mapping is set to forward to the index.vm file instead of the index.jsp
然后在Struts配置文件( WEB-INF\struts-config.xml),把 Struts动作映射设置为转向index.vm 文件而不是 index.jsp 文件,如清单 22 所示
It also contains Struts Action and ActionForm classes, a Model service class, a JSP page to display the results, and source code for both a publisher and a subscriber.
它还包含有Struts Action和ActionFor m类、模型服务类以及用来为发布者与订购者显示结果及其源代码的JS p页。
You can indicate which action to take, what model to use, which view to display to the user, what validation rules to employ, which forms to display ... Struts is totally configurable.
您可以指出采取哪种动作,使用什么模型,将哪种视图显示给用户,采用什么验证规则,显示哪种表单 ...
Modify the Struts configuration to register the new action.
修改Struts配置以注册新的动作。
Figure 3 illustrates a basic action hierarchy for Rails and Struts.
图3演示了Rails和 Struts基本的动作层次结构。
Following the Struts architecture, you can create an action that takes three steps to generate the PDF document.
按照Struts架构,可以创建一个动作(action),通过三步生成pd f文档。
To build the same example app in Struts you would need two action classes for the two buttons, each requiring its own set of action mappings.
要用Struts构建这个相同的示例应用程序,需要两个操作类用于两个按钮,每个类又需要它自己的一组操作映射。
This allows avoidance of complex coding in the action class (as shown in the Struts 1 example) for converting the form bean in to the related domain model object.
这避免了在操作类中进行复杂编码(如struts1示例所示),将表单bean转换为相关域模型对象。
In addition, if you implement a validate method and set the validate flag in the corresponding action mapping entry in the Struts configuration file, the ActionServlet will invoke the validate method.
此外,如果您实现了一个验证方法并在Struts配置文件中相应的操作映射条目上设置了验证标志,ActionServlet将会调用那个验证方法。
A mapping of the action class with the URL path is registered with the Struts configuration so that all requests with a matching path are sent to the mapped action class for processing.
action类与URL路径的映射被注册到Struts配置中,这样所有具有匹配路径的请求都被发送到与路径相映射的action类,然后再进行处理。
A Struts forward is an object that is returned by an action, and that has two fields: a name and a path (typically the URL of a JSP).
Struts转发是由一个操作返回的对象,它有两个字段:一个名称和一个路径(通常是jsp的url)。
You will need to interact with the Struts framework to get and set information in the bean form, specify the next action, and so on.
将需要与Struts框架进行交互,以获取和设置Bean表单中的信息,并指定下一个操作,等等。
In Struts 2, the HTML input field names could be generated as OGNL expressions, which in turn helps eliminate complex coding in the action class.
在Struts2中,HTML输入字段名称可以生成为ognl表达式,后者有助于消除操作类中的复杂编码。
Registering the new action class with the Struts configuration
使用Struts配置注册新的action类
Click on the Servlets TAB, and change the name of the servlet from action to Struts.
单击servlets选项卡,然后将Servlet的名称从action更改为Struts。
Once the data is stored in the action class objects, Struts 2 puts that data onto the ValueStack in the form of the action object.
一旦数据存储在action类对象中,Struts2就以action对象的形式将数据放在ValueStack中。
Developers must be aware that Struts will create a single instance of the Action and allow multiple threads to invoke execute .
开发人员必须清楚,Struts创建的是Action的单一实例,并允许多个线程调用它的execute 。
应用推荐