• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question regarding Include

 
Appy Maheshwari
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am preparing for SCWCD . In one mock exam site(j2eecertificates.com) i m having prb in the question :
Which of the following statements correctly declares an element that allows the output result of a specified resource to be inserted in a JSP page? [Select all correct answers]
1 <jsp:include file="disclaimer.html" />
2 <jsp:forward page="disclaimer.html" flush="true" />
3 <jsp:include page="disclaimer.html" flush="true" />
4 <%@ include file="disclaimer.html" %>
5 <jsp:forward page="disclaimer.html" />

Acc to me it shud be 3 , 4
but the correct ans given thr is 3 ,5
Please help me !!
 
Michael Ku
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you are correct
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Appy,

I think that the 1 and 3 are correct. The "forward" just forward the response and the request to an other resource - it is not defined what the resource does with the incoming information.

Regards
M
 
paritosh ranjan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that 1 and 3 are correct.Only difference between them is that 1 happens to be a translation time include while while 3 is a request time include.
 
madhuri rajan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paritosh,

I think 1 and 3 are correct options, but both of them do it at request time. The only difference lies with the flush attribute which when set to true flushes the buffer before including.

Someone please correct me if am wrong ..
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Appy Maheshwari:
Hi All,
I am preparing for SCWCD . In one mock exam site(j2eecertificates.com) i m having prb in the question :
Which of the following statements correctly declares an element that allows the output result of a specified resource to be inserted in a JSP page? [Select all correct answers]
1 <jsp:include file="disclaimer.html" />
2 <jsp:forward page="disclaimer.html" flush="true" />
3 <jsp:include page="disclaimer.html" flush="true" />
4 <%@ include file="disclaimer.html" %>
5 <jsp:forward page="disclaimer.html" />

Acc to me it shud be 3 , 4
but the correct ans given thr is 3 ,5
Please help me !!



Option 1 is incorrect because the attribute for the <jsp:include> action is page not file.

Option 2 cannot be correct since the question asks that the o/p of the resource is inserted into the JSP page. If the JSP page has already committed the response, the forward would throw an IllegalStateException. Option 5 is the same except for the flush attribute so it cannot be correct either.

Option 3 is correct.

Option 4 is confusing; it is correct because the included resource is an HTML page; a static resource, hence it's o/p will be the same always. However, it might seem incorrect because it's not really the "response" of the resource, it's the simply the resource itself being added inline to the JSP during translation.

But seeing how the other options are incorrect, the correct choices would be 3 and 4 if there are two correct answers and only 3 if 1 answer is to be picked.

Note: I'm really unsure about option 4.
 
Appy Maheshwari
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all of you : ))
Today i have given the exam & scored 89 % ....
But i am neither happy nor satisfied : ((
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic