This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

include directive -> Can include web component?

 
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In HD Book [p-220], it's mentioned that include directive can include any web component in a JSP page.

However when i tried to include a servlet (using include directive), it gave me a error.

org.apache.jasper.JasperException: /jsp/JSP_Static_Include.jsp(9,3) File "/SV_MyInitServlet" not found
 
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it because Servlet not a static resource? Include directive can only used for static resource.
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yups you are right :

Static include -> Static resources -> Contents
Dynamic include -> Dynamic (+Static) resources -> Output
 
Sandeep Vaid
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hendy,
By the way JSP is also not a static resource.
Still i can include JSP with include directive.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sandeep,

You can use JSP with include directive because the content of the included JSP is copied in the calling JSP. For e.g I have a Jsp:
a.jsp->
and I include it in b.jsp:

The code of the b_jsp.java will be something like this:
out.print("<html> <body>");
out.print("Dear User...");
out.print("<h1> Welcome to my page </h1>");
out.print("</body></html>");
Thus the code from a.jsp is merely copied in the resulting java file of b.jsp. You can also take it as, source of jsp is included in the calling jsp page.
I hope it is clear to you now, why jsp being dynamic can be used with include directive and why servlet cannot be used.
[ May 07, 2007: Message edited by: Rancy Chadha ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic