Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP  RSS feed

 
Ripan Karmakar
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have read and also tested the process of using Java Bean through JSP but my concept is not clear about the function/purpose of "property" attribute in the jsp bean tag.
Plz anyone let me know the actual.


ripank
 
Diogo Magalhaes
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a JavaBean is a class that has properties. You might access properties only by getters and setters (Ex.: getFoo(), setFoo() ...).
Somewhere in your JSP, you may need to access some property of your bean.. Then you should use the 'property' attribute of the tag.

When you code:

it shows
When you code:

it shows


Is it Clear? Or didn't I understand your question?

Regards,
Diogo Magalhaes
 
Ripan Karmakar
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx ..... but I think in bean tag their should be id not the name...... any way......i want to know that whenever we use getter/setter methods we write as
getmethod() though the actual method is getMethod()...... r u catch me???
then how it will recognise the original method in a bean class???

gerads

ripank
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ripan Karmakar:
Thanx ..... but I think in bean tag their should be id not the name...... any way......i want to know that whenever we use getter/setter methods we write as
getmethod() though the actual method is getMethod()...... r u catch me???
then how it will recognise the original method in a bean class???

gerads

ripank


Sample JavaBean


So in your JSP to get the color value of your JavaBean, or to set the color value of the JavaBean, you would use the property "color".

It's more complicated than this get the gist of it is the bean tag will take your property, add "set" or "get" to the front and CAPITALIZE the first letter of your property.

So color becomes setColor or getColor

HTH
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!