• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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