Java Reference
In-Depth Information
<TD>Post code:</TD>
<TD><INPUT TYPE="text"
NAME= "postCode"></ TD>
</TR>
<TR>
<TD>Order item:</TD>
<TD><INPUT TYPE="text"
NAME= "orderItem"></ TD>
</TR>
<TR>
<TD>Quantity:</TD>
<TD><INPUT TYPE="text"
NAME= "quantity"></ TD>
</TR>
</TABLE>
<BR><BR>
<INPUT TYPE="submit" VALUE= "Send order">
</FORM>
</BODY>
</HTML>
An example featuring user input when the above page is displayed is shown in
Fig.
10.7
.
The bean to be used will simply hold instance variables corresponding to all form
values shown on the above page (
with identical names
) and their corresponding
accessor and mutator ('get' and 'set') methods.
We'll call our bean
OrderBean
and place it into package
shopping
…
package shopping;
import java.util.*;
public class OrderBean implements java.io.Serializable
{
private String name;
private String addressLine1, addressLine2,
addressLine3;
private String postCode;
private String orderItem;
private int quantity;
private Date orderDate;
public String getName()
{
return name;
}
Search WWH ::
Custom Search