aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ final mock exam question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ final mock exam question" Watch "HFSJ final mock exam question" New topic

HFSJ final mock exam question

valli kotari

Joined: Jul 08, 2005
Posts: 4
This is a question from hfsj final mock exam

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");

he gave the answers a and c.

but i thought its just a as he is asking about static content.

any help?
Divya Guttikonda
Ranch Hand

Joined: Mar 09, 2005
Posts: 47
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?

valli kotari

Joined: Jul 08, 2005
Posts: 4
Hi ,

earlier i saw your post divya congrats for your score.

i am not clear about the above 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

so i am not sure.
Radmika Arunachalam
Ranch Hand

Joined: Mar 29, 2004
Posts: 45
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.."
Mat Williams
Ranch Hand

Joined: Jul 20, 2005
Posts: 215
Hi Radmika,

You are right the question asks "WHICH JSP CODE..", because answer D does not have <% %> surounding it (ie its not a scriptlet) it is not valid in a jsp.

Technical, even pedantic I know.

Brad Howerter

Joined: Jan 06, 2006
Posts: 4
Okay, D is wrong, but what's wrong with B (which uses jsp:forward)? I just tried it and it works fine.

I guess it's how you interpret 'include'. When you forward to something, you include it's response, I say.
It is sorta covered in the JavaRanch Style Guide.
subject: HFSJ final mock exam question