?? userinfo.java
字號:
package jdbcbook.shopping.form;
import org.apache.struts.action.ActionForm;
public class Userinfo
extends org.apache.struts.action.ActionForm
{
// 用戶類型常量定義
private static final int TYPE_USER = 0;
private static final int TYPE_ADMIN = 1;
// 主鍵
private int id;
public int getId( )
{
return this.id;
}
public void setId( int id )
{
this.id = id;
}
// 會員名
private String logname;
public String getLogname( )
{
return this.logname;
}
public void setLogname( String logname )
{
this.logname = logname;
}
// 登錄密碼
private String password;
public String getPassword( )
{
return this.password;
}
public void setPassword( String password )
{
this.password = password;
}
// 真實姓名
private String name;
public String getName( )
{
return this.name;
}
public void setName( String name )
{
this.name = name;
}
// 身份證號碼
private String idnumber;
public String getIdnumber( )
{
return this.idnumber;
}
public void setIdnumber( String idnumber )
{
this.idnumber = idnumber;
}
// 郵政編碼
private String postcode;
public String getPostcode( )
{
return this.postcode;
}
public void setPostcode( String postcode )
{
this.postcode = postcode;
}
// 地址
private String address;
public String getAddress( )
{
return this.address;
}
public void setAddress( String address )
{
this.address = address;
}
// 聯系電話
private String telp;
public String getTelp( )
{
return this.telp;
}
public void setTelp( String telp )
{
this.telp = telp;
}
// 電子郵件
private String email;
public String getEmail( )
{
return this.email;
}
public void setEmail( String email )
{
this.email = email;
}
// 用戶類型
private int type;
public int getType( )
{
return this.type;
}
public void setType( int type )
{
this.type = type;
}
// 判斷這個用戶是不是管理員
public boolean isAdmin()
{
return this.type==TYPE_ADMIN;
}
// 判斷這個用戶是不是注冊用戶
public boolean isUser()
{
return this.type==TYPE_USER;
}
// 判斷這個用戶是不是這個角色
public boolean isRoles( String[] roles )
{
if( roles==null || roles.length<=0 ) return true;
for( int i=0; i<roles.length; i++ )
{
if( ( "admin".equals( roles[i] ) && isAdmin() )
|| ( "user".equals( roles[i] ) && isUser() ) )
return true;
}
return false;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -