Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

c:import

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • 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?
 
Lee Kian Giap
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic