Servlet层将String型数据转int型

String型数据转int型数据

将前台获取的String类型数据,转化为int类型

//将前台获取的String类型数据,转化为int类型
int age1 = Integer.parseInt(req.getParameter("age"));		//方式1		

int age2 = Integer.valueOf(req.getParameter("age")).intValue();	//方式2

猜你喜欢

转载自blog.csdn.net/Xxacker/article/details/85099053