• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp:getproperty

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I've a problem with a question about jsp:getproperty:


Given the JavaBean class:
public class MyBean {
private Boolean roasted = false;
public MyBean () {}
public Boolean isRoasted () { returned roasted }
public void setRoasted (Boolean roasted) { this.roasted = roasted; ]
}
Assume a controller has created an instance of this bean, called setRoasted (true), and
inserted the bean into the application scope using the name 'myBean'.
A JSP contains these two tags:
<jsp: useBean id = 'aBean' class = 'MyBean' scope = 'page' \ />
<jsp: getProprty name = 'aBean' property = 'roasted' \ />
Which is true?
A. the page will include the output false
B. the page will include the output
C. the page will report that the property roasted does not exist
D. the page will report that the syntax of the useBean tag is incorrect
E. the page will report that the syntax of the getProperty tag ls incorrect


The book says E, but I cannot understand why. I thought the right answer was A.
Could someone help me please?

Thank you
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please QuoteYourSources
 
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

giuseppe russo wrote:Hi!
I've a problem with a question about jsp:getproperty:


A JSP contains these two tags:
<jsp: useBean id = 'aBean' class = 'MyBean' scope = 'page' \ />
<jsp: getProprty name = 'aBean' property = 'roasted' \ />
Which is true?
A. the page will include the output false
B. the page will include the output
C. the page will report that the property roasted does not exist
D. the page will report that the syntax of the useBean tag is incorrect
E. the page will report that the syntax of the getProperty tag ls incorrect


The book says E, but I cannot understand why. I thought the right answer was A.
Could someone help me please?

Thank you



Notice that useBean tag is closed at the place where it started... It should close after the getProperty tag...
 
reply
    Bookmark Topic Watch Topic
  • New Topic