Action interaction in Struts and form submission: view an employee

employee_list_view.gif

Let us change the application to view an employee information in a separate form.

employee_view.gif

To view an employee we will create a separate Action class, EmployeeActionView, which will handle "view" event:

{{{/**

public class EmployeeActionView extends Action {

} }}}

We will change the employee list page so that EmployeeActionView is called when a user clicks on employee ID:

{{{<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

<html:html>

</html:html>}}}

The employee list is displayed with the simple Action class as in the first Struts sample (see above). The configuration file reflects the relationship of two actions:

{{{<form-beans>

</form-beans>

<action path = "/employeesListView"

</action>

<action path = "/employeeActionView"

</action>}}}

This example uses EmployeeForm to temporarily store input/output data.

StrutsQuickStart3 (last edited 2009-09-20 23:12:46 by localhost)