Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP question ? Clarify

 
dharmendra Rathor
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given a JSP page called mypage.jsp with the following code

<%
request.setAttribute("greeting","good");
%>
<jsp:include page="menu.jsp" />
<p>morning</p>

And an available file called menu.jsp that contains the following code

<%
String greeting = (String) request.getAttribute("greeting");
out.print(greeting);
%>

What will happen when you attempt to compile and run mypage.jsp?
Choose one answer.
a. Compilation error the jsp:include tag takes a paramter of file not page Incorrect
b. compilation and output of good only Incorrect
c. compilation and output of good morning Correct
d. compilation and output of greeting Incorrect
e. compilation and output of greeting morning Incorrect
f. compilation and output of greeting morning Incorrect
Answer is c .
 
Meena R. Krishnan
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C is the correct answer. What is your doubt?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic