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

Java Bean Usage Doubt

 
sravanthi pulukuri
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

<html><body>
<jsp:useBean id="address" class="AddressBean" />
<jsp:setProperty name="address" property="city" value="LosAngeles" />
<jsp:setProperty name="address" property="city" />
<jsp:getProperty name="address" property="city" />
</body></html>
What is the output if the above page is accessed via the URL
http://localhost:8080/chap14/address.jsp?city=Chicago&city=Miami
Assume that the city property is not an indexed property. (Select one)
a LosAngeles
b Chicago
Licensed to Tricia Fu <tricia.fu@gmail.com>
REVIEW Q & A 453
c Miami
d ChicagoMiami
e LosAngelesChicagoMaimi
f It will not print anything because the value will be null or "".
Answer: b


Consider the following code:
<html><body>
<%{%>
<jsp:useBean id="address" class="AddressBean" scope="session" />
<%}%>
//1
</body></html>
Which of the following can be placed at line //1 above to print the value of the
street property? (Select one)
a <jsp:getProperty name="address" property="street" />
b <% out.print(address.getStreet()); %>
c <%= address.getStreet() %>
d <%= ((AddressBean)session.getAttribute(
"address")).getStreet() %>
e None of the above; the bean is nonexistent at this point.
Answer: d
 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sravanthi please UseCodeTags so that your code is readable.



Also you didn't mention what you didn't understand with this question and the other code that you posted



Also QuoteYourSources...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic