tags:

views:

81

answers:

1

Hi, I have this unusual scenario:

I have a registrationVO with few properties and getter setters for that. For example city or bCity with their getter methods getCity() and getBCity()

In JSP i tried to display the value of these properties using scriplets, <%=registrationVO.getCity()%> and <%=registrationVO.getBCity()%> , It works fine. But i replaced the same with expression language, ${registrationVO.city} and ${registrationVO.bCity} i got an error saying property "bCity" not found in registrationVO. i a used scriplet again for bCity, i got the output.

I observed that its because of the naming convention. "If the second character of the property is a Capital letter we cant use Expression Language". I have tried with many diff namings, this is what i found out.

Please check this scenario, I don't know wether my conclusion is right or wrong.

Thanks, DJ

A: 

If the property name of the getter method starts with at least two uppercase characters, then you need to use all of those uppercase characters in the EL property name as well. In your particular case, you need to replace it by ${registrationVO.BCity}.

That said, I would rather rename them to something more sensitive. Maybe birthCity (if I guess it right), so that you can just nicely use ${registrationVO.birthCity}.

BalusC
Hi Balus,Thanks for ypur reply. It really helped me as it worked. but il take your suggestion and rename it as billing City and billingState. Thanks,DJ
Dj