aspose file tools*
The moose likes JSP and the fly likes question on JSP directive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "question on JSP directive" Watch "question on JSP directive" New topic
Author

question on JSP directive

Vanchi Nathan
Ranch Hand

Joined: Feb 24, 2004
Posts: 107
Hi all,

I ve a question on JSP directives.

I am using a Include JSP directive to include a page "copyrights.jsp". The changes in the copyrights.jsp page immediately reflects during the run time, why?


thanks in adv..
[ August 30, 2005: Message edited by: Bear Bibeault ]

Best regards,<br /> <br />vanchin
Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
Hello Vanchi,
I guess it is because of dependency of your JSP on copyrights.jsp. JSP engine has considered your JSp & copyrights.jsp as a translation unit & as timestamp of one of the entity has changed JSP engine has retranslated entitr unit one more time so you are getting updated one.

Shrinivas
Vanchi Nathan
Ranch Hand

Joined: Feb 24, 2004
Posts: 107
Hi Shrinivas,

Thanks for the reply,

I suppose this sought of refresh could only be done by the JSP action tag, because the include action tag does the updation of the JSP page during the run time.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This used to be the case.
Many servers now check the timestamp on included JSPs and will re-generate and re-compile underlying servlet if they get updated.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Vanchi Nathan
Ranch Hand

Joined: Feb 24, 2004
Posts: 107
Hi Ben,

Just to clarify, then what is the difference between using an include directive than a JSP action tag ?

Thanks,
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724


Includes the file, it is compiled into result servlet.



Includes the response of the included page, not the page itself.


SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Vanchi Nathan
Ranch Hand

Joined: Feb 24, 2004
Posts: 107
hi david,

can i say that when 'include' directive is used there is only one servlet that serves the request and when 'include' Jsp action tag is used there are individual servlets for every action tag to server the request..

thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

yes
Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
Hello David,Vanchi

I don't think so in generated servelt there will be a pointer kind of information about from which page response should be included & as servlet is multithreaded there is no need to have different servlet instances for include action tag.


Shrinivas
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Shrinivas Mujumdar:
Hello David,Vanchi

I don't think so in generated servelt there will be a pointer kind of information about from which page response should be included & as servlet is multithreaded there is no need to have different servlet instances for include action tag.
Shrinivas


Each of the JSPs (the parent and included page) will result in it's own generated servlet class.
The two will be executed at run time and their output merged.

With the include directive <%@... the sourc of the two JSPs will be combined when generating the servlet code and only one servlet class will result.
Bob wang
Greenhorn

Joined: Sep 02, 2005
Posts: 1
Amarender Reddy
Ranch Hand

Joined: May 12, 2005
Posts: 54
[Bear edit: removed 'me too' response which not only was superfluous, but incorrect.]
[ September 03, 2005: Message edited by: Bear Bibeault ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: question on JSP directive