Extend the Struts action class to handle the HTTP request.
扩展Struts动作类以处理HTTP请求。
The code contains a few Struts action classes and a couple of JSPs.
代码包含少量Struts动作类和两个jsp页面。
Struts portlets use a Struts action to trigger the property transfer.
Strutsportlet使用一个Struts行为来触发这个属性转换。
Here is a Struts action method that will save or update a person.
这里给出一个在Struts中保存或更新person模型实例的action。
This is a default parameter name for all Struts action and cannot be changed.
这是所有Struts行为默认的参数名称,不能更改。
Each Action class implements the execute method of the Struts Action class.
每个action类都将实现Struts action类的execute方法。
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动作;它演示如何从对象管理器获取对象。
Find servlet-mappings.xml and servlets.xml in the code tree, and see how the Struts Action servlet is declared.
请在代码树中找到servlet -mappings . xml和servlets . xml,并查看Struts动作servlet的声明方式。
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页。
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)。
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。
应用推荐