{"id":1698,"date":"2016-09-22T04:31:37","date_gmt":"2016-09-22T04:31:37","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1698"},"modified":"2016-09-22T04:38:03","modified_gmt":"2016-09-22T04:38:03","slug":"passing-parameters-to-another-jsp-file-using-tag","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/passing-parameters-to-another-jsp-file-using-tag\/","title":{"rendered":"Passing parameters to another JSP file using <jsp:include> tag"},"content":{"rendered":"<p><strong>parent.jsp<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n&lt;c:forEach var=&quot;instanceVar&quot; items=&quot;${instanceList}&quot;&gt;\r\n    &lt;jsp:include page=&quot;child.jsp&quot;&gt;\r\n        &lt;jsp:param name=&quot;myVar&quot; value=&quot;${instanceVar}&quot;\/&gt;\r\n    &lt;\/jsp:include&gt;\r\n&lt;\/c:forEach&gt;\r\n<\/pre>\n<p><strong>child.jsp<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n&lt;c:out value=&quot;${param.myVar}&quot;\/&gt;\r\n<\/pre>\n<p><strong>Another alternative is using JSTL tag c:set and request scope.<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n&lt;c:set var=&quot;instance&quot; value=&quot;${your.value}&quot; scope=&quot;request&quot;\/&gt;\r\n&lt;jsp:include page=&quot;instance.jsp&quot;\/&gt;\r\n<\/pre>\n<p><strong>instance.jsp<\/strong><br \/>\n<em>You should take out the variable from request Scope<\/em><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n&lt;c:out value=&quot;${instance}&quot;\/&gt;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>parent.jsp &lt;c:forEach var=&quot;instanceVar&quot; items=&quot;${instanceList}&quot;&gt; &lt;jsp:include page=&quot;child.jsp&quot;&gt; &lt;jsp:param name=&quot;myVar&quot; value=&quot;${instanceVar}&quot;\/&gt; &lt;\/jsp:include&gt; &lt;\/c:forEach&gt; child.jsp &lt;c:out value=&quot;${param.myVar}&quot;\/&gt; Another alternative is using JSTL tag c:set and request scope. &lt;c:set var=&quot;instance&quot; value=&quot;${your.value}&quot; scope=&quot;request&quot;\/&gt; &lt;jsp:include page=&quot;instance.jsp&quot;\/&gt; instance.jsp You should take out the variable from request Scope &lt;c:out value=&quot;${instance}&quot;\/&gt;<\/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-1698","post","type-post","status-publish","format-standard","hentry","category-jsp"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1698","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=1698"}],"version-history":[{"count":3,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1698\/revisions"}],"predecessor-version":[{"id":1701,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1698\/revisions\/1701"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}