which jsp code would you use to include static content in a jsp? a)<%@ include file="/segments/footer.html" %> b)<jsp:forward page="/segments/footer.html" /> c)<jsp:include page="/segments/footer.html" /> d)RequestDispatcher dispatcher=request.getRequestDispatcher("/segments/footer.html"); dispatcher.include(request,response);
he gave the answers a and c.
but i thought its just a as he is asking about static content.
Hi I think both the answers are correct.By static content he dont mean at translation time or request time.Just the plain static html pages or something.If he say specifically request time or translation time then you have to go only for either include directive or jsp:include.Hope this clears ur doubt.Any corrections?
Joined: Jul 08, 2005
earlier i saw your post divya congrats for your score.
i am not clear about the above doubt.in page 450 of HFSJ he says....
a)include directive <%@ include file="header.html" %> STATIC:adds the content from file at translation time.
b)the <jsp:include> standard action <jsp:include page="header.jsp" /> DYNAMIC:adds content at request time.
c)the <c:import> JSTL tag <c:import url="...." /> DYNAMIC:adds content from url at request time
Hi, For the same Question, Please can anyone tell me why option D is wrong? it is also one of the possible ways to include page right and also question didnt asks only "WHICH JSP CODE.." not "WHICH STANDARD ACTION.."