• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a qstn

 
tony lee
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given:
<jsp:useBean id="temp"
class="java.lang.String" />
<% temp="temp";
out.println(temp); %>
What is the output?
A) temp
B) empty
C) ServletException
D) null
A is correct choice.
I think var temp in <% temp="temp";
out.println(temp); %> is not defined. How does it work
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"temp" is defined by the useBean tag...
- Peter
 
Axel Janssen
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tricky question.
As we all know the jsp generates a servlet from the .jsp-file. These servlets (source + class files) are stored in a special directory (in Tomcat its called <root>/work). Sometimes it helps to examine these files. This is such a case, I think. Then you see, why it is as it is.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic