Solved

Dynamic Include variable

Posted on 2004-09-24
6
459 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

707 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