Once the user submits the input page, the reply should contain the account balance, or an error message if the account number was not found, or if another error occurs.› Before you can use the EJB to process the form submission, you need to set up the page to display the results.›
When the servlet receives a POST request from the form, it builds a second HTML page based on what was entered in the InputPage.› To create this response, you need to add an HTML document that contains the text of the response page, and a ServletPost behavior that sends the page when the servlet receives a POST.
Now you can add the content of the balance page. The text of the page needs to include the account number the user entered on the first page and the balance of that account.› If the account number was invalid, the page should display an error message. You also need to include text so the user knows what the account number refers to.
Now you need to display the actual account number that the user gave you. The account number gets sent to the servlet as a parameter that you set up earlier on the input page form. Once posted, the capsule holds the value of the accountNumber parameter. Since this value changes each time a different user tries to get their account balance, you need to create a behavior that finds the current value of the parameter and formats it as HTML text.
SetAccountis output, you want the SetAccount to activate.
Send To: actor.
Const: button to toggle it to
Eval: to capsule.getParameter(žaccountNumberÓ).
SetAccount finds the value of the accountNumber parameter and sends it to the AccountNumber text component.
For formatting the balance page, add a line break between the display of the account number and the balance.
So far, the capsule simply redisplays the account number that the user entered on the input page.› You can check this by running the servlet. When you enter an account number and click Get Balance, the browser should show a new page that redisplays the account number.
In the next section you will add the EJB to the capsule, and use it so that it processes the account number and retrieves the balance.