{"id":1723,"date":"2016-09-22T10:40:34","date_gmt":"2016-09-22T10:40:34","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1723"},"modified":"2016-09-22T10:59:05","modified_gmt":"2016-09-22T10:59:05","slug":"difference-between-getattribute-and-getparameter","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/difference-between-getattribute-and-getparameter\/","title":{"rendered":"Difference between getAttribute() and getParameter()"},"content":{"rendered":"<table>\n<thead>\n<tr>\n<th>getParameter()<\/th>\n<th>getAttribute()<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>getParameter will return the value of a parameter that was submitted by an HTML form or that was included in a query string<\/td>\n<td>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<\/td>\n<\/tr>\n<tr>\n<td>the return type for a parameter is a String<\/td>\n<td>The return type for attributes is an Object<\/td>\n<\/tr>\n<tr>\n<td> The Scope of parameter is per individual request<\/td>\n<td>attribute is a server variable that exists within a specified scope<br \/>\n    application, available for the life of the entire application<br \/>\n    session, available for the life of the session<br \/>\n    request, only available for the life of the request<br \/>\n    page (JSP only), available for the current JSP page only\n<\/td>\n<\/tr>\n<tr>\n<td>\n request.getParameter(&#8220;parameterName&#8221;) in java is used for accessing variable from JSP or HTML\n<\/td>\n<td>RequestDispatcher.forward(request, response) in java and request.getAttribute(&#8220;attributeName&#8221;) in jsp are used for accessing variables<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>getParameter() getAttribute() 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&hellip; <a href=\"https:\/\/codethataint.com\/blog\/difference-between-getattribute-and-getparameter\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[],"class_list":["post-1723","post","type-post","status-publish","format-standard","hentry","category-jsp"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=1723"}],"version-history":[{"count":3,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1723\/revisions"}],"predecessor-version":[{"id":1726,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1723\/revisions\/1726"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}