• 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 directive doubt

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

the syntax for include is


I tried the following but it does not seem to work
<%String filePath = "/WEB-INF/jsp/test.html";%>

<%@ include file=filePath; %>

Just want to know..if possible

Thanks
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi John,


<%String filePath = "/WEB-INF/jsp/test.html";%>
<%@ include file=filePath; %>


When you run this code what error message do you get? I am not sure of what you are getting but I think you should get message saying 'quotes expected'. The reason is that directive attributes take value in quotes. Instead of putting 'file=filepath' try putting 'file="/WEB-INF/jsp/test.html" it should work. I have tried this and it has worked. Also one more addition, there should not be a ; terminating include directive this also will lead to an exception.
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The include directive inserts the text of the specified resource into the page at translation-time. So, the relative URL should be static. In your example, the filePath will be the local variable in your _jspService() method and will be evaluated at request time.

Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic