• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Difference Between jsp include directive and include action element.

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

I know that include directive adds in jsp page at translation time while include action add up at runtime. But i am facing a problem that i have created a jsp named Index.jsp and two other termed as Header.jsp and Footer.jsp. I add Header by include directive and Footer by include action and deployed whole in tomcat and run the jsp page. Till here everything is fine , now i made changes on both Header and Footer files and saved them(remember no change in Index.jsp). Now according to definition only changes made in Footer .jsp should be reflect on the browser, but i am getting all the changes made in both Header.jsp and Footer.jsp in my browser. I want to ask that if both are producing the same result than what is the difference b/w include directive(<%@ include file="Header.jsp" %>) and include action element(<jsp:include page="Footer.jsp" />).
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Now according to definition only changes made in Footer .jsp should be reflect on the browser, but i am getting all the changes made in both Header.jsp and Footer.jsp in my browser



You are right about the concept. But new containers are smart enough to reflect the changes you made through include directive. That's why you are getting that output. But that's not guranteed by the spec.

what is the difference b/w include directive(<%@ include file="Header.jsp" %> and include action element(<jsp:include page="Footer.jsp" /> .



Well, file with include directive little heavier than that would have <jsp:include> in it (with the directive, it copy everything in the included file whereas include standard action it contains a line which will include the response of the included file at runtime . The include directive is used more with the static contents.
[ December 04, 2008: Message edited by: Vijitha Kumara ]
 
Let's go to the waterfront with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic