You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Hardee, Tony" <To...@ps.net> on 2002/03/21 14:48:55 UTC

OT: Dynamic JSP include

I apologize in advance for submitting an off topic request to the struts
user community.  However, this group is quite knowledgeable and helpful and
I could really use some assistance.

Basically I want to have a dynamic include in a JSP.  Ideally I would like
the following snipping to work.

1  <% 
2      String product = request.getParameter("product");
3      if (product != null) {
4           product = product.replace(' ', '_');
5      } else {
6      	  product = "";
7      }
8      String includeFile = "static-html/opinion-request/" + product +
9                           "_process_overview.html";
10 %>
11 <jsp:include page=<%=includeFile%>/>

Unfortunately, line 11 does not work as desired.  I have tried variations
placing " around the <%= directive but that does not help.

Any help is greatly appreciated.

Tony


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: OT: Dynamic JSP include

Posted by sander-martijn <em...@sander-martijn.com>.
I've done this with resin on linux, osx and w2k and with 
websphere/sunOs - when i tried it last week using 
tomcat/apache/struts/linux (not sure versions of any of them because 
i'm not at work) I got an error message telling me it was against the 
jsp spec.  I'll get the exact message and versions later.  I would 
love to find out why, as this is something i've used widely on big 
projects - esp. with websphere since it doesn't support custom tags. 
What server/configuration are you having this problem with?
sander


>i'm surpised, i do the same thing in one of my JSP's (tomcat 3.2 on RH7.1
>linux) :
>
>i create a variable (incPage) in a preceeding <% %> block then issue
>
><jsp:include page="<%= incPage %>" flush="true"/>
>
>Which works fine - is the URL you generate correct?
>
>On Thursday 21 Mar 2002 1:48 pm, you wrote:
>>  I apologize in advance for submitting an off topic request to the struts
>>  user community.  However, this group is quite knowledgeable and helpful and
>>  I could really use some assistance.
>>
>>  Basically I want to have a dynamic include in a JSP.  Ideally I would like
>>  the following snipping to work.
>>
>>  1  <%
>>  2      String product = request.getParameter("product");
>>  3      if (product != null) {
>>  4           product = product.replace(' ', '_');
>>  5      } else {
>>  6     	  product = "";
>>  7      }
>>  8      String includeFile = "static-html/opinion-request/" + product +
>>  9                           "_process_overview.html";
>>  10 %>
>>  11 <jsp:include page=<%=includeFile%>/>
>>
>>  Unfortunately, line 11 does not work as desired.  I have tried variations
>>  placing " around the <%= directive but that does not help.
>>
>>  Any help is greatly appreciated.
>>
>>  Tony
>
>--
>Martin Samm
>m_sam@rroom.net
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


-- 
*********************************************************
  Sander-Martijn Milks
  Interface Engineer / Architect
   e: email@sander-martijn.com
   w: www.sander-martijn.com/
   p: 914.396.8119
   f: 914.939.0639
   p: page@sander-martijn.com

- program to an interface and not to an implementation
*********************************************************

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: OT: Dynamic JSP include

Posted by Martin Samm <m_...@rroom.net>.
i'm surpised, i do the same thing in one of my JSP's (tomcat 3.2 on RH7.1 
linux) : 

i create a variable (incPage) in a preceeding <% %> block then issue 

<jsp:include page="<%= incPage %>" flush="true"/>

Which works fine - is the URL you generate correct?

On Thursday 21 Mar 2002 1:48 pm, you wrote:
> I apologize in advance for submitting an off topic request to the struts
> user community.  However, this group is quite knowledgeable and helpful and
> I could really use some assistance.
>
> Basically I want to have a dynamic include in a JSP.  Ideally I would like
> the following snipping to work.
>
> 1  <%
> 2      String product = request.getParameter("product");
> 3      if (product != null) {
> 4           product = product.replace(' ', '_');
> 5      } else {
> 6      	  product = "";
> 7      }
> 8      String includeFile = "static-html/opinion-request/" + product +
> 9                           "_process_overview.html";
> 10 %>
> 11 <jsp:include page=<%=includeFile%>/>
>
> Unfortunately, line 11 does not work as desired.  I have tried variations
> placing " around the <%= directive but that does not help.
>
> Any help is greatly appreciated.
>
> Tony

-- 
Martin Samm
m_sam@rroom.net

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>