19.09.2015 Views

Prentice.Hall.Introduction.to.Java.Programming,.Brief.Version.9th.(2014).[sharethefiles.com]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The HTML file that displays the form is identical <strong>to</strong> Registration.html<br />

in Listing 42.8 except that the action is replaced by<br />

HGetRegistrationData.jsp.<br />

GetRegistrationData.jsp, which obtains the data from the form, is shown<br />

in Listing 43.17. A bean is created in lines 3–4. Line 5 obtains the<br />

property values from the form. This is a shorthand notation. Note that<br />

the parameter names and the property names must be the same <strong>to</strong> use this<br />

notation.<br />

Listing 43.17 GetRegistrationData.jsp<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Registration Using JSP<br />

<br />

You entered the following data<br />

Last name: <br />

First name: <br />

MI: <br />

Telephone: <br />

Email: <br />

Address: <br />

City: <br />

State: <br />

Zip: <br />

<br />

<br />

<br />

<br />

<br />

<br />

GetRegistrationData.jsp invokes S<strong>to</strong>reStudent.jsp (line 31) when the user<br />

clicks the Confirm but<strong>to</strong>n. In Listing 43.18, the same addressId is<br />

shared with the preceding page within the scope of the same session in<br />

lines 3–4. A bean for S<strong>to</strong>reData is created in lines 5–6 with the scope<br />

of application.<br />

24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!