`
i_am_birdman
  • 浏览: 274505 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

difference between request.getParameter() and request.getAttribute()

阅读更多
What is the difference between request.getParameter() and request.getAttribute()?

I too have another doubt in session. What is the difference between session.getValue() and session.getAttribute()?


The difference between getAttribute and getParameter is that getParameter will return the value of a parameter that was submitted by an HTML form or that was included in a query string. getAttribute returns an object that you have set in the request, the only way you can use this is in conjunction with a RequestDispatcher. You use a RequestDispatcher to forward a request to another resource (JSP / Servlet). So before you forward the request you can set an attribute which will be available to the next resource. Does this make sense?



I had a look at the API docs for session.getAttribute() and getValue() and saw that getValue is deprecated and getAttribute should be used in its place, so rather use getAttribute. Although it seems like they achieve the same result. I personally have never used getValue.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics