JavaBean的部分用法(一)

本文介绍了一个简单的JavaBean实例,展示了如何通过TestBean类实现javabean与jsp的联合使用。TestBean类包括用户名、密码等属性及其getter和setter方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



这个实体类是javabean


package com.zdsoft.bean;

/**
* javabean+jsp的联合使用
* @author liuyegonghzi
*
*/
public class TestBean
{
private String username;
private String password;
private String sex;
private Integer age;
private String birthday;
private String[] hobby;
private String hobbys=”“;
/**
* @return the username
*/
public String getUsername()
{
return username;
}
/**
* @param username the username to set
*/
public void setUsername(String username)
{
this.username = username;
}
/**
* @return the sex
*/
public String getSex()
{
return sex;
}
/**
* @param sex the sex to set
*/
public void setSex(String sex)
{
this.sex = sex;
}
/**
* @return the age
*/
public Integer getAge()
{
return age;
}
/**
* @param age the age to set
*/
public void setAge(Integer age)
{
this.age = age;
}
/**
* @return the birthday
*/
public String getBirthday()
{
return birthday;
}
/**
* @param birthday the birthday to set
*/
public void setBirthday(String birthday)
{
this.birthday = birthday;
}
/**
* @return the hobby
*/
public String[] getHobby()
{
return hobby;
}
/**
* @param hooby the hobby to set
*/
public void setHobby(String[] hobby)
{
this.hobby = hobby;
}
/**
* @return the hobbys
*/
public String getHobbys()
{
if(this.hobby.length>0){
for(String str:hobby){
this.hobbys+=str+”,”;
}
this.hobbys=hobbys.substring(0, hobbys.length()-1);
}
return hobbys;
}
/**
* @param hobbys the hobbys to set
*/
public void setHobbys(String hobbys)
{
this.hobbys = hobbys;
}
/**
* @return the password
*/
public String getPassword()
{
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password)
{
this.password = password;
}

}


表单jsp


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值