• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:include standard action

 
Harshana Dias
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I have two questions.

1)We know in first request in include standard action a runtime request is going to the header jsp which it complile and become a servlet. So what hapen in the second runtime request for the header jsp. Is it just allocate the thread already created header file servlet or is it do the whole header compilation thing again?

2)When we want customize include file we know we use the param attribute in the main jsp and change the header (include) jsp. But if we change the header (for use that param)it will have impact on other pages know..do we have to use a separate header jsp ? i mean header2 jsp like

Thank you.
 
Narendhiran Nagarajan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)We know in first request in include standard action a runtime request is going to the header jsp which it complile and become a servlet. So what hapen in the second runtime request for the header jsp. Is it just allocate the thread already created header file servlet or is it do the whole header compilation thing again?
The include directive inserts the SOURCE of “Header.jsp”, at translation time.
But the <jsp:include /> standard action inserts the RESPONSE of “Header.jsp”, at runtime.
[Source: HFSJ]

The include directive gets compiled only once(On first Request).
But the include standard action gets compiled for every Request.

I m not clear with your second ques.Can you rephrase it.
 
Vinay Nath
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Narendhiran, thts not right. it will not get compiled everytime in case of include action. It gets compiled again only when header.jsp is changed otherwise it will just use the existing servlet and create a thread, execute it and return the results to including jsp(servlet).

its actually using the RequestDispatcher behind the scenes.

2) depends on your requirement, you could always say tht if the passed parameter is null then display the generic message tht you want for other jsp's.

Vinay



Narendhiran Nagarajan wrote:1)We know in first request in include standard action a runtime request is going to the header jsp which it complile and become a servlet. So what hapen in the second runtime request for the header jsp. Is it just allocate the thread already created header file servlet or is it do the whole header compilation thing again?
The include directive inserts the SOURCE of “Header.jsp”, at translation time.
But the <jsp:include /> standard action inserts the RESPONSE of “Header.jsp”, at runtime.
[Source: HFSJ]

The include directive gets compiled only once(On first Request).
But the include standard action gets compiled for every Request.

I m not clear with your second ques.Can you rephrase it.
 
Harshana Dias
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vinay Nath wrote:1) Narendhiran, thats not right. it will not get compiled everytime in case of include action. It gets compiled again only when header.jsp is changed otherwise it will just use the existing servlet and create a thread, execute it and return the results to including jsp(servlet).

its actually using the RequestDispatcher behind the scenes.

2) depends on your requirement, you could always say that if the passed parameter is null then display the generic message that you want for other jsp's.

Vinay



Thank you Vinay.

So you mean in second question we put param value as null so that in include header will not print anything.

Main JSP,

<jsp:include page="Header.jsp">
<jsp:param name="abc" value="null">
</jsp:include>

For Header.jspf

${param.abc} so will not print anything.

Also is it ok to use .jsp extension here because we name the header extension as .jspf?? im referring HFSJ in page 412












 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic