!!! Listing 1: Parameter von !!! Listing 2 // insert table headers // [...]

// selection of month and year // [...]

// navigation


!!! Listing 3 public class SelectTrainForm extends org.apache.struts.action.ActionForm { private String action = null; // action parameter of the form private String selectedTrain = null; private String month = null; private String day = null; private ArrayList daysOfMonth = null; // read-only for use in the view // getters / setters // [...] /** * Resets the form data for reuse of the instance */ public void reset(ActionMapping mapping, HttpServletRequest request) { selectedTrain = null; // [...] /** * Validates the input-data of the form */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); // no train selected if ((selectedTrain == null) || (selectedTrain.length() < 1)) // add new ActionError with internationalized // error message from Resource Bundle errors.add("train_error", new ActionError("SelectTrainView.errors.train")); } } !!! Listing 4 public class SelectTrainAction extends or.apache.struts.action.Action { /** * Called from the Struts-Controller-Servlet */ public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // Extract attributes Locale locale = getLocale(request); MessageResources messages = getResources(); HttpSession session = request.getSession(); ActionErrors errors = new ActionErrors(); // check user role // [...] // get Parameters from ActionForm String action = ((SelectTrainForm)form).getAction(); String trainNum = ((SelectTrainForm)form).getSelectedTrain(); String travelDay = ((SelectTrainForm)form).getDay(); String travelMonth = ((SelectTrainForm)form).getMonth(); // get data from db and set values to session // [...] // set db-data to SelectSeats-Form if it exists in scope session if (session.getAttribute("SelectSeatsForm") != null) ((SelectSeatsForm)session.getAttribute("SelectSeatsForm")).setDBData(request); // report errors if (!errors.empty()) { saveErrors(request, errors); // forward to input-form return (new ActionForward(mapping.getInput())); } // [...] // Forward control to the specified next/back URI if (action != null && action.equals(messages.getMessage(request.getLocale(), "SelectTrainView.next"))) { // forward to next page return (mapping.findForward("next")); } // forward to last page else return mapping.findForward("back"); } }