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

question

 
jeffrey z. lee
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given:
<jsp:useBean id="temp" lass="java.lang.String" /> <% temp="temp";out.println(temp); %>
What is the output?
A temp
B empty
C ServletException
D null
 
Kyle Tang
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I myself found reading the generated java file very important when studying JSP. Jeffrey, try it. then you will find JSP is not too complicated.
 
Paul McKenna
Ugly Redneck
Ranch Hand
Posts: 1006
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..
I tried out the above piece of code and it works in JRUN 4.0. However my question is this, doesn't the useBean action require the class to conform to JavaBeans specs? That is have setters and getters for fields in the class??.. Or does this mean that java.lang.String does conform to the JavaBean Spec?
Thanks
SR
 
Stefan Zoerner
Author
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
java.lang.String is a valid JavaBeans component. The only constraint (as far as I remember) is the existence of a no-args-constructor which String has.
Greetings from Hamburg,
Stefan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic