java web project 枚举的使用

 

枚举如下:

public enum UinUserType {
    pc,
    mobilePhone
}
 
访问地址:
127.0.0.1:8080/sxxx/sxx/test.htm?userType=pc

action解析方式:
	String userType = request.getParameter("userType");UinUserType uUserType = null;
	if(UinUserType.pc.name().equals(userType)){
		uUserType = UinUserType.pc;
	}else if(UinUserType.mobilePhone.name().equals(userType)){
		uUserType = UinUserType.mobilePhone;
	}
	this.uinUserType = uUserType;
 

 

你可能感兴趣的:(Java Web)