In this step you will learn how to process data submitted from users and forward users to a page where the results are displayed. The tasks in this step are:
First you will edit the hello action method to implement the business logic for handling the user input. Specifically, you will construct a String message that takes the name from the form bean and you will make this message available to the next page. The message is made available to the next page by making it an attribute (property) of the request object, which can be read by the next JSP page.
/** * @jpf:action */ protected Forward hello(HelloForm form) { // Construct a message from the submitted name. String message = "Hello, " + form.getName() + "!"; // Place the message on the request object. getRequest().setAttribute("message", message); return new Forward("success"); }
Now you will enhance the hello method to implement the navigation logic. Specifically, you will modify the action method to call the response.jsp page.
The hello method is now complete and should like this in Source View.
Let's rearrange the icons in Flow View so that it becomes easier to read the flow.
Let's now test the page flow to make sure you have correctly executed the above steps.