• 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
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

c:import

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In example for <c:import url=http://www.wickedlysmart.com/skyler/horse.html"/>

but actually the server has horse.gif? Then why do we say "horse.html" and not "horse.gif" to be imported?
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you test it in Tomcat, you will know answer.

c:import are used to include the contents of a file dynamically, means after Container evaluate.

In the header.jsp, if you use <c:import url=http://www.wickedlysmart.com/skyler/horse.html"/>
The Container evaluate the horse.html (no translation and compilation done here because it is not horse.jsp ), it return the code fragment of the horse.htm (because html is just a bunch of String) to the c:import line (that is <image .... >)
[Remember : Container is not web browser it will not render html code]
So the final response return to the client is an html page with the <image> tag, the browser render it and send another request for the image.

In the header.jsp, if you use <c:import url=http://www.wickedlysmart.com/skyler/horse.gif"/>
The Container evaluate the horse.gif, return the horse.gif to the c:import line ( that is a bunch of text which
represent the image )
So the final response return to the client is an html page without the <image> tag , that bunch of text is just a plain text shown by the web browser.
 
I just had the craziest dream. This tiny ad was in it.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic