• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Include in jsps

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bill
 
Chandar Vel
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic