• Post Reply Bookmark Topic Watch Topic
  • New Topic

mock exam question

 
harikumar devandla
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which of the following statements are correct regarding the code?

<jsp:useBean id="name" class="java.lang.String" />
<%= name %>

1. wont compile
2. It is valid jsp line and it ll print the variable called name
3. It ll compile but produce null as the output
4.It ll work if u create a javabean class with only one variable of type java.lang.String

Can anyone help me with this question.?

Thanks
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am inclined to say none of the above. It will compile and print blank as the output.
 
Mikalai Zaikin
Ranch Hand
Posts: 3381
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it may be assumed answer 4) - every bean must have unique name in its scope.

regards,
MZ
 
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!