• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

Pass dynamic variable to include????

I want to pass a parameter to an include:
<%

String stage = request.getParameter("primaryComp");

%>

<jsp:include page="test.jsp?stage=<%=stage%>" flush="true"/>



/////////////////////
but this doesn't work? Any ideas?? The parameter is being passed in.
0
894359
Asked:
894359
  • 4
  • 4
1 Solution
 
CEHJCommented:
<jsp:include ...
<jsp:param name="stage" value="<%stage%>" />
</jsp:include>
0
 
894359Author Commented:
I tried;

<jsp:include page="test.jsp" flush="true"/>
        <jsp:param name="stage" value="red"/>
          </jsp:include>

And it comes up null in the include???

Here's how I'm calling it in the include:

String stage = request.getParameter("stage");
0
 
CEHJCommented:
So it's coming up null even with a literal (as above)?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
894359Author Commented:
That's correct!
0
 
CEHJCommented:
Hmm, not sure why. I'm clocking off now, but objects will be able to help out (soonish probably)
0
 
894359Author Commented:
I figured out why I was having problems, for some reason, I had to remove the "/" in the include call:

<jsp:include page="test.jsp" flush="true">
        <jsp:param name="stage" value="<%=stage%>"/>
          </jsp:include>
0
 
CEHJCommented:
:-)

Hmm. Can you please post the code that's now working?
0
 
894359Author Commented:
<jsp:include page="test.jsp" flush="true">
       <jsp:param name="stage" value="<%=stage%>"/>
         </jsp:include>

:)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now