Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

a qstn

 
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
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"temp" is defined by the useBean tag...
- Peter
 
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.
 
I'd appreciate it if you pronounced my name correctly. Pinhead, with a silent "H". Petite ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic