Java Reference
In-Depth Information
dayDDM.append("</SELECT>");
this
.dayDDM = String.valueOf(dayDDM);
return this
.dayDDM;
}
}
6.
In Java Resources/src/c9, create a new Java class called YearBean.
7.
Change the YearBean source to the following:
package
c9;
import
java.util.Calendar;
public class
YearBean {
public
String yearDDM =
new
String();
private int
currYear;
private
Calendar c = Calendar.getInstance();
public
YearBean() {
}
public
String getYearDDM() {
currYear = c.get(Calendar.YEAR);
StringBuffer YearDDM =
new
StringBuffer("<SELECT name='YearDDM'>");
for
(
int
ctr = currYear - 1; ctr <= currYear + 1; ctr++) {
YearDDM.append("<OPTION value='");
YearDDM.append(String.valueOf(ctr));
if
(ctr == currYear) {
YearDDM.append("' selected>");
}
else
{
YearDDM.append("'>");
}
YearDDM.append(String.valueOf(ctr));
YearDDM.append("</OPTION>");
}
YearDDM.append("</SELECT>");
this
.yearDDM = String.valueOf(YearDDM);
return this
.yearDDM;
}
}
8.
In ReviewExWeb/WebContent, create a new folder called c9.
9.
In ReviewExWeb/WebContent/c9, create a new JSP called EnterShipInfoJSP.
Instead of recreating an entry form for the shipment information, you will copy all the components from
ShipInfoForm.
10.
Display the ShipInfoForm in the Design view.
11.
Select all the components on the page (i.e., the text and form), click
Edit
, and then
Copy
.
12.
Display EnterShipInfoJSP in the Design view.
13.
Click Edit, then Paste.