{"id":2808,"date":"2023-01-06T17:07:50","date_gmt":"2023-01-06T16:07:50","guid":{"rendered":"https:\/\/bob-team.de\/wordpress\/?p=2808"},"modified":"2023-05-28T13:13:08","modified_gmt":"2023-05-28T11:13:08","slug":"implicit-objects","status":"publish","type":"post","link":"https:\/\/bob-team.de\/wordpress\/2023\/01\/06\/implicit-objects\/","title":{"rendered":"Parameters from the URL with JSP"},"content":{"rendered":"<p>About the <a href=\"http:\/\/java.sun.com\/javaee\/5\/docs\/tutorial\/doc\/bnahq.html#bnaif\">Implicit Objects<\/a> of the <a href=\"http:\/\/java.sun.com\/javaee\/5\/docs\/tutorial\/doc\/bnahq.html\">Unified Expression Language<\/a>, the <a href=\"http:\/\/java.sun.com\/javaee\/5\/docs\/tutorial\/doc\/\">Java EE 5 Tutorial<\/a> writes:<\/p>\n<ul>\n<li>The <strong>pageContext<\/strong> for the JSP page. Provides access to various objects including:\n<ul>\n<li><strong>servletContext<\/strong>: The context for the JSP page\u2019s servlet and any web components contained in the same application. See Accessing the Web Context.<\/li>\n<li><strong>session<\/strong>: The session object for the client. See Maintaining Client State.<\/li>\n<li><strong>request<\/strong>: The request triggering the execution of the JSP page. See <a href=\"http:\/\/java.sun.com\/javaee\/5\/docs\/tutorial\/doc\/bnafv.html#bnafw\">Getting Information from Requests<\/a>.<\/li>\n<li><strong>response<\/strong>: The response returned by the JSP page. See Constructing Responses.<\/li>\n<\/ul>\n<\/li>\n<li>In addition, several implicit objects are available that allow easy access to the following objects:\n<ul>\n<li><strong>param<\/strong>: Maps a request parameter name to a single value<\/li>\n<li><strong>paramValues<\/strong>: Maps a request parameter name to an array of values<\/li>\n<li><strong>header<\/strong>: Maps a request header name to a single value<\/li>\n<li><strong>headerValues<\/strong>: Maps a request header name to an array of values<\/li>\n<li><strong>cookie<\/strong>: Maps a cookie name to a single cookie<\/li>\n<li><strong>initParam<\/strong>: Maps a context initialization parameter name to a single value<\/li>\n<\/ul>\n<\/li>\n<li>Finally, there are objects that allow access to the various scoped variables described in Using Scope Objects.\n<ul>\n<li><strong>pageScope<\/strong>: Maps page-scoped variable names to their values<\/li>\n<li><strong>requestScope<\/strong>: Maps request-scoped variable names to their values<\/li>\n<li><strong>sessionScope<\/strong>: Maps session-scoped variable names to their values<\/li>\n<li><strong>applicationScope<\/strong>: Maps application-scoped variable names to their values<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre lang=\"java\">${param.abc}<\/pre>\n<pre lang=\"java\"><c:out value=\"${param.abc}\"><\/c:out><\/pre>\n<pre lang=\"java\"><c:out value=\"${param['abc']}\"><\/c:out><\/pre>\n<pre lang=\"java\"><%= request.getParameter(\"abc\") %><\/pre>\n<pre lang=\"java\"><%\r\n    String abc = request.getParameter(\"abc\");\r\n    if (abc == null) {\r\n        out.println(\"???\");\r\n    } else {\r\n        out.println(abc);\r\n    }\r\n%><\/pre>\n<p>&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<p><em>copied from <a href=\"https:\/\/stackoverflow.com\/questions\/1890438\/how-to-get-parameters-from-the-url-with-jsp#1890462\">stackoverflow.com<\/a><\/em><\/p>\n<p>Parameter weitergeben&#8230;<\/p>\n<pre lang=\"java\">\r\n<c:set var=\"abc\" value=\"${abc}\" scope=\"session\"\/>\r\n<c:out value=\"${sessionScope.abc}\"\/>\r\n<c:set var=\"abc\" value=\"${empty param.abc ? sessionScope.abc : param.abc}\"\/>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>About the Implicit Objects of the Unified Expression Language, the Java EE 5 Tutorial writes: The pageContext for the JSP page. Provides access to various objects including: servletContext: The context for the JSP page\u2019s servlet and any web components contained in the same application. See Accessing the Web Context. session: The session object for the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-2808","post","type-post","status-publish","format-standard","hentry","category-java","entry"],"_links":{"self":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/2808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/comments?post=2808"}],"version-history":[{"count":16,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/2808\/revisions"}],"predecessor-version":[{"id":3214,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/posts\/2808\/revisions\/3214"}],"wp:attachment":[{"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/media?parent=2808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/categories?post=2808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bob-team.de\/wordpress\/wp-json\/wp\/v2\/tags?post=2808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}