You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anwar Sadat <an...@mphasis.com> on 2001/08/22 12:20:54 UTC

problem in including file in INCLUDE TAG in jsp

Hi all,
   I have a problem in including a html file in the JSP file. 
I have a 2 jsp's. The first jsp has a submit button.
When i click on this submit button, I pass the filename as hidden type.
I get this hidden variable in my next jsp.
I will am trying to include this hidden variable in my include tag.
 
here is the code snippet.
 
first JSP.
 
<form name=editPreferences method="post" action="http://serverb/two.jsp">
<input type="submit" value="Edit Preferences">
<input type="hidden" name="url" value="/abc.htm">
</form>
 
My second JSP 
<% String sUrl = request.getParameter("url"); %>
 
<%@ include file="<%=sUrl%>" %>
 
 
Is this correct.. I am having problems in compiling the second JSP..
 
Kindly help me regarding this. 
Quick response is appreciated.
 
Thanx in advance.
 
Regards
Anwar K


RE: problem in including file in INCLUDE TAG in jsp

Posted by Malcolm Wise <ma...@sde.eu.sony.com>.
AW: SilverStream behind firewallAnwar,

I don't think you can use expressions in an include directive.
Try
<jsp:include page="<%= sUrl %>" flush="true" />

Malc

-----Original Message-----
From: Anwar Sadat [mailto:anwar.sadat@mphasis.com]
Sent: 22 August 2001 11:21
To: 'struts-user@jakarta.apache.org'
Subject: problem in including file in INCLUDE TAG in jsp


Hi all,
   I have a problem in including a html file in the JSP file. 
I have a 2 jsp's. The first jsp has a submit button.
When i click on this submit button, I pass the filename as hidden type.
I get this hidden variable in my next jsp.
I will am trying to include this hidden variable in my include tag.

here is the code snippet.

first JSP.

<form name=editPreferences method="post" action="http://serverb/two.jsp">
<input type="submit" value="Edit Preferences">
<input type="hidden" name="url" value="/abc.htm">
</form>

My second JSP 
<% String sUrl = request.getParameter("url"); %>

<%@ include file="<%=sUrl%>" %>


Is this correct.. I am having problems in compiling the second JSP..

Kindly help me regarding this. 
Quick response is appreciated.

Thanx in advance.

Regards
Anwar K