• Post Reply Bookmark Topic Watch Topic
  • New Topic

Does c:import tag cache the page.

 
dhaval vyas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this question might be answered before, but I searched and couldn't find the answer.

Does the tstl tag c:import cache the page in server, or it goes and retrieve the page every time it is called. Also what is the behavior of the jsp:include tag. ?

Thank You.
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

Basically there are two ways to include jsp to another jsp. But one mre JSTL also provide functionality to include jsp or out side page also.

1 ) Include Directive: <%@ include file="relativeURL" %>
2 ) Standard Action <jsp:include page="xyz.jhtml" >
3 ) JSTL <c:import .... />

The behavior or 2 and 3 include method are same. They include your jsp at run time. At run time jsp convert into servlet and include the response of your converted jsp to servlet file it is not include all the contains of the file.

While 1 one Include Directive: <%@ include file="relativeURL" %> just copy the contains of file and past at that location.

So when your contain of jsp change dynamically it is better to use 2 ) Standard Action <jsp:include page="xyz.jhtml" > or 3 ) JSTL <c:import .... />.

One more Advantage of JSTL <c:import .... />. is you can include the response of out side of your web application also.

While other two must include your application page.


 
Mohamed Inayath
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following the feedback of Nishan:

With<jsp:include> or the include directive, you can include only pages that are part of the current web application.
With <c:import> you can have the option to pull in content from outside the container.

Like JSP in AppA residing in ServerA pulling a resource resB from the AppB residing in ServerB.
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi,

yes you can get contains from live url.

Like <c:import url = "http://www.xyz.com"> also..


That way you can get...

 
dhaval vyas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You very much, guys.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!