Hi All, This might look simple 4 u. How does JSP engine understand need to translate JSP into Servlet and recompile? The answer is obvious, JSP engine looks at timestamp of jsp and translated servlet class file. If jsp file is most recently modified, it is translated again. That's fine. But let's take an example where index.jsp inlcludes header.jsp. The index.jsp is translated into servlet and servlet is compiled. But then I modify header.jsp without modifying index.jsp. Still JSP engine understands there is need to recompile servlet. Can any one clarify whether code for included jsp is also put in translated servlet or only included JSP page's servlet's response is included in the including servlet? In simple words, whether servlet of index.jsp will include code for header.jsp also? Or it will simply have code to include response from servlet created for header.jsp? Pls clarify. Thanks in advance. Sandesh
Regards,<br />Sandesh<br />(SCJCP, SCWCD, SCBCD - 99%, OCP-1)<br /> <br />Either find a way or create one.
if the include directive is used the included file is actually copied into the servlet that is generated for the jsp page that includes it. changes in the included file are not updated in the main page until you change the main page if jsp:include is used the included file is processed at runtime and so changes in the included file are always effective immediately. if you want to know exactly how each is done do one of each and look in your tomcat/work directory to see what the generated code is!
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
Sandesh, As I said in last post. If you Use jsp:include then the output of included jsp is copied in your outputstream object(out) where as if you use <%@ include file=.... %> then the actual code is copied in your jsp which is including other jsp. so in your example servlet of index.jsp will include code of header.jsp if you use <%@ include ......%> else it will simply have code to include response from servlet created for header.jsp. SO I guess ,if header.jsp is changed and Index.jsp is not,then there is no way for server to understand that Index.jps has to be recompiled so in this case the changes should not reflect in output of index.jsp. But this is just my guesing ,plz verify,and do let me know if i m wrong Hope I was't confusing Cheers Praful
All desirable things in life are either illegal, banned, expensive or married to someone else !!!
subject: How does JSP engine understand need to translate JSP into Servlet and recompile?