Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP question ? Clarify  RSS feed

 
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!