request.getParameter()是获得通过get或者post获得来的数据
getAttribute()是之前自己设定的
比如request.setAttribute("name","小强");
然后另一页面
String name=request.getAttribute("name");
name就是小强喽
getParameter()用来获得
如:www.111.com?id=xxx&passwd=xxx中的参数id和passwd
对于传入参数较少的请求比较好用
getAttribute()则更多用来获取封装后的数据,
再用封装数据的get()方法获得具体的单一属性值
getAttribute()是之前自己设定的
比如request.setAttribute("name","小强");
然后另一页面
String name=request.getAttribute("name");
name就是小强喽
getParameter()用来获得
如:www.111.com?id=xxx&passwd=xxx中的参数id和passwd
对于传入参数较少的请求比较好用
getAttribute()则更多用来获取封装后的数据,
再用封装数据的get()方法获得具体的单一属性值