I get a list of operations similar to charAt - concat, empty, contains so on. I want to use charAt and compare the character to render the field.
When i am trying to use the above mentioned syntax i get this exception:
Property 'charAt' not found on type java.lang.String
I would like to know if there is any way to use these string operations.
I don't really recommend putting much logic in EL expressions. For a number of reasons, it's better to reference simple properties and put the logic in the backing bean instead.
However, your biggest mistake was to code
when you should have coded
One refers to an indexed property named "charAt", the other refers to the actual String charAt() method.
Incidentally, that's one of the reasons why I recommend putting the logic in the bean. EL is interpreted and only blows up when you attempt to execute it. Regular Java would have given a compile-time error message, instead.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jan 16, 2010
Thanks for the welcome Tim...
Putting the logic in the EL expression is my need and putting it in the backing bean does not make sense in my case (where i am implementing this). According to you the biggest mistake in my code is charAt, yes i know that it is refers to an indexed property, but jsf treats charAt(0) as a method call.
I would appreciate i you could provide me with some resolution along with pointing out the mistake. My requirement is i need to do the comparison nearly 5000 times in my entire web application and i am not interested in writing the code in the back-end. Actually i want to go for a bit level comparison here so was initially trying how charAt works.
So if you can help me out in how to use it in the rendered tag that would be of great help.
I noticed also that your backing bean name violated capitalization conventions. Backing beans are instances, not classes, so the first character should be lower-case. If you don't do that, the app will still work, but you can't take full advantage of the annotation feature and some IDEs may yell at you.