Solved

Dynamic Include variable

Posted on 2004-09-24
6
452 Views
Last Modified: 2013-11-18
I want to pass a dynamic 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. I also tried:
////////////////////

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

And I still get null for the value in the include. Even if I change the value to something static:

 <jsp:param name="stage" value="test"/>


I'm calling the value in the include as so:

String stage = request.getParameter("stage");
0
Comment
Question by:894359
6 Comments
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12149128
this will not work

i will give it in 5 mins. bear with me
0
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 500 total points
ID: 12149243
check this
<jsp:include page="test.jsp" flush="true">
       <jsp:param name="stage" value="<%=stage%>">
</jsp:param>
         </jsp:include>
0
 

Expert Comment

by:yan_er04
ID: 12151172
You can try
                        
<jsp:include pagetest.jsp" flush="true">
<jsp:param name="stage" value="<%=stage%>" />
</jsp:include>
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.

 
LVL 7

Expert Comment

by:CajunBill
ID: 12153419
Howdy 894,

Two things:
1. try leaving off the closing "/" in the jsp:param.  In other words, use
<jsp:include page="integrityTrust.jsp" flush="true"/>
 <jsp:param name="stage" value="test">
  </jsp:include>

2. In the include, access the value in HTML (not JSP) by
${param.stage}

You had a good idea in using static data to test with.  See if you can get it working at all using the static data before moving on to your real intent.

HTH, Cajun
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 12153440
<jsp:include page="test.jsp" flush="true">
       <jsp:param name="stage" value="<%=stage%>"/>
         </jsp:include>
0
 
LVL 1

Expert Comment

by:KartikShah
ID: 12169330
Try using the include directive i.e.

<%@include file="integrityTrust.jsp" %>

Using this, you will not not need to pass the variable, since it is a compile time include, the variable stage declared by you will be directly accessible in the include page. :)

Kartik
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

828 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