i am using import jstl tag, is it better to use jsp:include instead of import?
<c:choose>
<c:when test="${item.id=='masters'}">
<c:import url="/newclickmenu/mastermenuitems.jsp"></c:import>
</c:when>
<c:when test="${item.id=='sales'}">
<c:import url="/newclickmenu/salesmenuitems.jsp"></c:import>
</c:when>
</c:choose>
<c:import>
will offer a flexibility, and functionality improvement in addition to <jsp:include>
.
<c:import>
will allow you to specify content from other web applications, and contexts, as well as web servers; this gives you more flexibility.
Keep in mind though, that a static include, is always faster than a dynamic one; meaning
that<%@ include file="" %>
is faster than both <jsp:include>
and <c:import>
.
Technically, <c:import>
should only be used if you require its functionality, or flexibility, the improvement in performance is minimal.
Some might state that implementing <c:import>
is bad practice if you do not need it due to it being more heavy weight than <jsp:include>
.