
案例二:使用表达式设置属性 I,知识目标:设置bean的属性。 2,技整目标,使用表达式设置ben的属性。 3.参考代码: 们AVANEAN代码 package chap09. public class NewHelloBean private String name="". private String sex private int age■0 publie NewHelloBean() public void setName String name this name name. publie String getName月 return this name. puhlic void setSex(String sex) this sex "sex, publie String getSex) retur this sex. publie int getAge) return this age
案例二:使用表达式设置属性 1.知识目标:设置 bean 的属性。 2.技能目标:使用表达式设置 bean 的属性。 3.参考代码: //JAVANEAN 代码 package chap09; public class NewHelloBean{ private String name=""; private String sex=""; private int age = 0; public NewHelloBean(){ } public void setName( String name ){ this.name = name; } public String getName(){ return this.name; } public void setSex( String sex ){ this.sex = sex; } public String getSex(){ return this.sex; } public int getAge() { return this.age; }

publie void setAge(int age) this ageage, 1 接收数据的表单一 chead> ritle>数据输入 p心请输入数据pe p>姓名 sinput type='text"name="name"> t性别&ntsp.  .&ntp,  cselect name-"sex"> 先生 Coption valu-'小姐">小姐/option> 小elecp chr> 年龄 P
public void setAge(int age) { this.age = age; } } //接收数据的表单------ 数据输入 请输入数据 姓名 性别 先生 小姐 年龄

p :4p cpcnbsp.p div </badyp himb