views:

57

answers:

2

I have a Java class with a method, hasMoreParameters().

In JSP, I want to get the property:

${holder.moreParameters}

How do I do this?

+5  A: 

You can not access holder.hasMoreParameters() as you have specified:

${holder.moreParameters}

This is because the ${bean.property} syntax only works with methods that follow JavaBean getter/setter naming conventions. This means the property's accessor method must start with 'get'. There is only one exception to this rule: if the method returns a boolean value, the method is allowed to start with 'is'.

If, as in your case, the method name does not meet these criteria, you must find some other way to access the data, such as passing the value in a request attribute, or renaming the method.

Mike Clark
A: 

This doesn't work: ${holder.hasMoreParameters()}

But, is there something similar that does?

magician