Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL c:import

 
Rishi Chopra
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is the Below statement correct

c:import tag is more efficient than jsp:include action in the case when large amount of data is imported only to be given to another tag.

I think the only way c:import is better than jsp:include is that it lets you import the contents from outside the web application

Regards
Rishi Chopra
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are right. The only advantage c:import offers is that you can reach out of your web app.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what the spec has to say about it -

In the JSP specification, a <jsp:include> action provides for the inclusion of static and dynamic resources located in the same context as the current page. This is a very convenient feature that is widely used by page authors.
However, <jsp:include> falls short in flexibility when page authors need to get access to resources that reside outside of the web application. In many situations, page authors have the need to import the content of Internet resources specified via an absolute URL. Moreover, as sites grow in size, they may have to be implemented as a set of web applications where importing resources across web applications is a requirement.

<jsp:include> also falls short in efficiency when the content of the imported resource is used as the source for a companion process/transformation action, because unnecessary buffering occurs. In the example below, the <acme:transform> action uses the content of the included resource as the input of its transformation. <jsp:include> reads the content of the response, writes it to the body content of the enclosing <acme:transform>, which then re-reads the exact same content. It would
be more efficient if <acme:transform> could access the input source directly and avoid the buffering involved in the body content of <acme:transform>.
The main motivation behind <c:import> is to address these shortcomings by
providing a simple, straightforward mechanism to access resources that can be specified via a URL. If accessing a resource requires specifying more arguments, then a protocol specific action (e.g. an <http> action) should be used for that purpose. JSTL does not currently address these protocol-specific elements but may do so in future releases.



i guess this makes clear -

1. c:import is more efficient in handling large data.
2. it can import data from outside the web app

hth
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic