• 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

Help on dynamically Including html files in JSP

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am trying to dynamically include files in my JSP. Following is what i am trying to do:
I have an array which has name of files.
<%
sarray[1] = "file1.html";
sarray[2] = "file2.html";
sarray[3] = "file3.html";
%>
Using the for loop
<%
for(int i=1; i<4; i++)
{
%>
<%@include file = "<%=sarray[i]%>" %>
<%}%>
I am just looping through and including the files, but tomcat gives an error saying File "" not found. The file is the same directory as my JSP. It doesnt work. Please let me know what is wrong here.
I wanted to have all the html files in a seperate directory and include using the full path name like C:\webapps\soe\file1.html , but it didnt work, so i copied the html files in the same directory and tried still the same error. please let me know a solution to this.

Thanks
Priyha
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic