Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes is param implicit object bean or Map(EL)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "is param implicit object bean or Map(EL)?" Watch "is param implicit object bean or Map(EL)?" New topic
Author

is param implicit object bean or Map(EL)?

Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
i have a html page


Now jsp file for above html file is

now param implicit is bean so we can write
${param.name} which will display name.
Then how can we write
${param["name"]}
Because ${param["name"]} is used for Map where param is bean.


Please help
Thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

param is a Map, not a bean.
So calling param.name will invoke get("name") on the map.
[ November 27, 2006: Message edited by: Satou kurinosuke ]

[My Blog]
All roads lead to JavaRanch
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
Thanks Satou for reply
it means both param.name or param["name"] will invoke get("name").
is it so?
Ashwini Hegde
Greenhorn

Joined: Apr 10, 2006
Posts: 4
The dot(.) opearator can be used with maps and beans. When used with a map, the name to the right of the operator is the key in the map, whereas when used with a bean, the value to the right is the name of the property in the bean we are trying to access.

The [] operator can be used in all cases where the (.) operator is used. In addition, it can also be used in cases where the left had side of the [] operator is an arrya or a list.

And yes, as already stated, param is a map not a bean. The only implicit object in EL implicit objects list that is a bean is the pageContext. All the others are map objects.

so, param["name"] and param.name will return the same result.
[ November 27, 2006: Message edited by: Ashwini Hegde ]
 
wood burning stoves
 
subject: is param implicit object bean or Map(EL)?
 
Similar Threads
why my jstl.jar and standard.jar is not working
Problem in compiling Jsp
EL HTTP 500 status error
EL implicit object pageContext
Doubt in EL?