0

I have a JSP page which is called with various URL parameters like this: http://myserver.com/page_A.jsp?paramA=hello&paramB=you

This page however doesn't do anything with the URL parameters; it's just supposed to pass them on to a second JSP page page_B.jsp.

I know I can call in page_A.jsp the second page easily with fixed parameters:

<!-- this is part of page_A.jsp -->
<jsp:include page="page_B.jsp">
        <jsp:param name="paramA" value="hello" />
        <jsp:param name="paramB" value="you" />
</jsp:include>

But how can I pass dynamically all parameters given to page_A.jsp through to page_b.jsp?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
halloleo
  • 9,216
  • 13
  • 64
  • 122
  • Possible duplicate / solution https://stackoverflow.com/questions/26973972/iterate-over-param-jstl-using-foreach – Scary Wombat Sep 29 '22 at 04:52
  • @ScaryWombat We don't have the JSTL library on this server, so no `` tags, only plain `` tags, and of course all the Java stuff between `<%... %>` tags. – halloleo Sep 29 '22 at 05:04
  • So just loop... – Scary Wombat Sep 29 '22 at 05:20
  • This answer might help: https://stackoverflow.com/questions/41149695/jsp-include-dynamic-page – Ankit Sharma Sep 29 '22 at 05:59
  • @AnkitSharma Thanks fro chiming in, but the question you're linking to talks about dynamic _pages_, but I have dynamic _URL parameters_ to a fixed page: How can I add the parameters from the request object in `page_A.jsp` in the tag to the request object of `page_B.jsp`? – halloleo Sep 29 '22 at 06:19
  • Is there a reason you need to navigate to the next page directly? Could you not process submission of your form, perform any necessary validation/binding and then display `page_B.jsp`? – mohammedkhan Sep 29 '22 at 09:38
  • @mohammedkhan The reason is that in- fact _two_ pages `page_A1.jsp` and `page_A2.jsp` will point to `page_B.jsp` and do only slightly different stuff, so the main URL logic should happen in `page_B.jsp`. – halloleo Sep 30 '22 at 06:02

0 Answers0