Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Include in jsps

 
Chandar Vel
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all
In my project I have to include an SSI in a jsp. To complicate things, the name of the SSI has to be dynamically choosen instead of being hard coded or fixed ones. Can any one suggest a way for this.
(ie) the existing code is
<%@ include file= "../../xyz.ssi"%>
instead of that i want it to be dynamically including the xyz.ssi
Your earliest response in this is highly appreciated as I need to make this change immediately....
Thanks a bunch
Chandar
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that this form of include:
<%@ include file= "../../xyz.ssi"%>
works at compile time to include the contents in the servlet that the JSP compiler makes, so it can't be changed at runtime.
The runtime include with a constant source is:
<jsp:include page="../../xyz.ssi" flush="true" />
with the source taken from the someString variable:
<jsp:include page="<%= someString %>" flush="true" />
Incidently, the java.sun.com/products/jsp page has a link to a nice two page summary of JSP syntax as a pdf file.
Bill

------------------
author of:
 
Chandar Vel
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill
 
Chandar Vel
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All
I tried using the <jsp:include>. But the SSI which i tried to include has some images in it which did n't get included. I want the exact SSI to be included before the jsp is compiled.
(eg)
JSP
<% String s="/abc/xyz.ssi";%>
<jsp:include page="<%=s%>"/>
......
......
xyz.ssi
this page contains
<img src= <%=abc%> >
javascript functions + Static content
Could anyone help me in this. This is very urgent requirement in my project. Appreciate your help.
Thanks
Chandar

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic