标签:style color java os io for ar cti
request.getAttribute():是request时设置的变量的值,用request.setAttribute("name","您自己的值");来设置值,
request.getParameter():提取发送过来的参数如:本网页
request.getParameter
是用来接受来自get方法或post方法的参数
<form method=post>
<form method=get>
<a href="1.jsp?id=1">ok</a>
只能接受java.lang.String
也就是说String hotel_id = request.getParameter("hotel_id");
request.getAttribute
是用来接受来自servlet的变量或Action(其实Action就是特殊的Servlet)
在Action中,request.setAttribute("ret",ret);
只能接受java.lang.Object
也就是说List ret = (List)request.getAttribute("ret");
如果你只用JSP,根本用不到request.getAttribute()
request.getAttribute()和request.getParameter()的区别是request.getAttribute()获得的是对象类型,而request.getParameter()获得的是字符串类型
request.getparameter和 request.getattribute的区别,布布扣,bubuko.com
request.getparameter和 request.getattribute的区别
标签:style color java os io for ar cti
原文地址:http://blog.csdn.net/qianquan003/article/details/38422667