• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp :forward

 
Nikhilesh Fonseca
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

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" />

Answers 3 and 5 are correct.

And I marked 3 and 4 ...
What am I missing here ..
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option 4, is wrong, because

<%@ include file="" %> won't compile and run the file given and past the output in including file. it just copy the content of the file to the including file.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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?


I am not getting the correct meaning of the question.

When you use directive to include the resource statically, the contents of the resource not the output is included in the JSP page ( It forms one translation unit).

When you include the resource dynamically using requestDispatcher, jsp:include action, the output is added to the response's output writer not in the JSP page itself. The including and included pages are processed seperately by the container.

Anybody please clarify

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic