Solved

Pass dynamic variable to include????

Posted on 2004-09-24
8
289 Views
Last Modified: 2011-08-18
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
Comment
Question by:894359
  • 4
  • 4
8 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 12148022
<jsp:include ...
<jsp:param name="stage" value="<%stage%>" />
</jsp:include>
0
 

Author Comment

by:894359
ID: 12148133
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 12148146
So it's coming up null even with a literal (as above)?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:894359
ID: 12148174
That's correct!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12148206
Hmm, not sure why. I'm clocking off now, but objects will be able to help out (soonish probably)
0
 

Author Comment

by:894359
ID: 12148299
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 12149407
:-)

Hmm. Can you please post the code that's now working?
0
 

Author Comment

by:894359
ID: 12427638
<jsp:include page="test.jsp" flush="true">
       <jsp:param name="stage" value="<%=stage%>"/>
         </jsp:include>

:)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error trying to install RTMT Win7 5 60
servlet filter example 37 61
jsp insert to database example 2 23
Which non-HTML GUI front end to use with Java? 3 22
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question