补充一下,bean里面都写了get方法,只是我没写出来
解决方案 »
- 正则表达式
- 如果一个jsp文件 不加<@page指令 他能拥有所有的功能吗
- hibernate 3.2 添加完数据 但是查询不出来
- 小妹现有一问题着急解决~ 哪位大侠帮帮忙~(javascript的)
- ●●●●原來得分這麼簡單●JSP基礎問題●●●
- web.xml修改后是不是要重启tomcat才生效
- JSP+MS SQL+JAVABEAN问题
- 在linux下使用tomcat的怪事。。。散分,哪位大虾和我分享
- SimpleDateFormat在那个包中?
- 这个语句可以在sql server中执行但是写在代码里总是报错
- jsp链接数据库,不用配置ODBC.如果做?
- 问JSF和servlet高手一个问题
if (rs.next())
{
name=rs.getString("name");
}
<%@page contentType="text/html; charset=gb2312" language="java"%>
<html>
<head>
<title>溢洋论坛</title>
</head>
<body text="#0000ff" >
<table cellspacing="0" cellpadding="0" border="0" width="99%" align="center">
<tr>
<p align="center">查看用户资料</p>
</tr>
<jsp:useBean id="memberClass" scope="page" class="entity.sys.Member"/>
<%!String loginName;%>
<%
memberClass.fillByLoginName("dpli");
%>
<tr bgcolor="#F7FBFF">
<td width="42%">名称</td>
<td bgcolor="#F7FBFF" width="58%"><%=memberClass.getLoginName()%> </td>
</tr>
<tr bgcolor="#F7FBFF">
<td width="42%">用户昵称</td>
<td bgcolor="#F7FBFF" width="58%"><%=memberClass.getNikeName()%> </td>
</tr>
<tr bgcolor="#F7FBFF">
<td width="42%">用户姓名</td>
<td bgcolor="#F7FBFF" width="58%"><%=memberClass.getRealName()%> </td>
</tr>
<tr bgcolor="#F7FBFF">
<td width="42%">姓别</td>
<td width="58%"><%=memberClass.getSex()%> </td>
</tr>
<tr bgcolor="#F7FBFF">
<td width="42%">居住地址</td>
<td width="58%"><%=memberClass.getAddress()%> </td>
</tr>
</table>
</body>
</html>
//网站会员
public class Member extends Person
{
//积分
private int integral;
//用户级别
private int level;
//购物次数
private int consumeTimes;
//账户余额
private double balance;
//消费总金额
private double ConsumeAmount; public Member()
{
init();
}
public boolean fillByLoginName(String loginName)
{
if (loginName == null || loginName.equals(""))
{
return false;
}
boolean rlt = false;
String sql = "select loginName,loginPass,userType,nickName,"
+ "realName,Sex,Age,Phone,Mobile,Email,Address,JoinDate,"
+ "integral,level,consumeTimes,balance,consumeAmount "
+ "from e_sys_member where loginName='"
+ loginName + "'";
ResultSet rs = DatabaseOperate.dbExecuteQuery(sql);
this.loginName = loginName;
try
{
if (rs != null && rs.next())
{
this.loginPass = rs.getString("loginPass");
this.nikeName = rs.getString("nickName");
this.realName = rs.getString("realName");
this.sex = rs.getString("sex");
this.age = rs.getInt("age");
this.phone = rs.getString("phone");
this.mobile = rs.getString("mobile");
this.email = rs.getString("email");
this.address = rs.getString("address");
this.joinDate = rs.getDate("joinDate");
this.integral = rs.getInt("integral");
this.level = rs.getInt("level");
this.consumeTimes = rs.getInt("consumeTimes");
this.balance = rs.getDouble("balance");
this.ConsumeAmount = rs.getInt("consumeAmount");
rlt = true;
}
}
catch (SQLException e)
{
e.printStackTrace();
rlt = false;
}
return rlt;
}
public void init()
{
super.init();
integral = 0;
level = GlobalData.Member.Level.LEVEL_0;
consumeTimes = 0;
balance = 0;
ConsumeAmount = 0;
}
public double getBalance()
{
return balance;
} public double getConsumeAmount()
{
return ConsumeAmount;
} public int getConsumeTimes()
{
return consumeTimes;
} public int getIntegral()
{
return integral;
}
public int getLevel()
{
return level;
}}
package entity;import java.util.Date;import util.GlobalData;
//joinDate字段可能为空
public class Person extends Entity
{
//用户名为索引
protected String loginName;
protected String loginPass;
protected String nikeName;
protected String realName;
protected String sex;
protected int age;
protected String phone;
protected String mobile;
protected String email;
protected String address;
protected Date joinDate; // new Date(GlobalData.Global.INIT_DATA_STR);
public Person()
{
init();
}
protected void init()
{
loginName = "";
loginPass = "";
nikeName = "";
realName = "";
sex = "";
age = GlobalData.Global.INIT_AGE;
phone = "";
mobile = "";
email = "";
address = "";
joinDate = null; // new Date(GlobalData.Global.INIT_DATA_STR); }
public static void main(String[] args)
{
}
public String getAddress()
{
return address;
} public int getAge()
{
return age;
}
public String getEmail()
{
return email;
}
public Date getJoinDate()
{
return joinDate;
}
public String getLoginName()
{
return loginName;
}
public String getLoginPass()
{
return loginPass;
}
public String getMobile()
{
return mobile;
}
public String getNikeName()
{
return nikeName;
}
public String getPhone()
{
return phone;
}
public String getRealName()
{
return realName;
}
public String getSex()
{
return sex;
}}