spring annotation getter for isMethod

393 views Asked by At

I want to use an is method in my bean instead of a getIsmethod. Is there a way to tell el that the method to use isn't a get method?

private boolean isSloAdmin = false;

//todo be nice to have it standard isMethod call
public boolean getIsSloAdmin() {
    return isSloAdmin;
}

Then the EL code is

${myForm.isSloAdmin}

Thank you !

1

There are 1 answers

3
JB Nizet On BEST ANSWER

That doesn't have anything to do with Spring. The standard convention for a boolean getter is to use a method starting with is. So your method should be

public boolean isSloAdmin() {
    return isSloAdmin;
}

And you should access it using the JSP EL like any other bean property:

${myForm.sloAdmin}