Do 'is' boolean methods work in JSPs with JSTL?

When coding in JSTL you often want to use conditional logic (I'm thinking and the like) to be able to structure your page correctly. Auto-generated getter & setter methods will normally create isX() methods for the getters of boolean values (at least in Eclipse it does) but can you access this method directly from JSTL without writing a getX() version?

Does JSTL support 'is' boolean methods though? Ask a random poll of Java we developers and you will get conflicting answers so I decided to investigate, want the short answer?

YES - JSTL does support accessing isX() methods directly as if you were accessing a getX() method, but only if the return type of the isX() method is a primative boolean. If you return an object of any kind (such as Boolean isObjectBooleanTrue()) then JSTL fails to find the method and will give you a rather nasty JSP exception:

javax.el.PropertyNotFoundException: The class 'com.andrewbeacock.BooleanTest' does
not have the property 'objectBooleanTrue'.
So yes, 'is' methods work in JSTL but make sure you ONLY return primitive booleans from them.

How to stop Eclipse reformating your Java enumerations & comments

Eclipse is a wonderful IDE for the Java language and I’ve used it daily for at least the past 4 years but it does have some 'issues'. One is regarding it’s code formatting (or reformatting) support, normally it does a great job of putting stuff in the right place but there are occasions where it just fails to get it right.

Enumerations
When I write enums I like to have each item on it's own row, I find it's easier to read and amend in the future:

public enum Family {
    MOTHER,
    FATHER,
    DAUGHTER,
    SON;
}
But Eclipse has other ideas and formats it so that it looks like this:
public enum Family {
    MOTHER, FATHER, DAUGHTER, SON;
}
A way to get around this (and any other times where you have a few lines of code that you don't want collapsing into one is to add the double-slash style code comments to the end of each line:
public enum Family {
    MOTHER, //
    FATHER, //
    DAUGHTER, //
    SON;
}
Block comments

I recently wanted to have a decent sized chunk of XML stored within Java's block comments (/* ... */) so that I could refer to it as I coded a mapping class. Everytime I saved the class Eclipse reformatted my XML so that it looked like someone had been sick on the page.

After a little digging I found this gem buried in the original coding conventions document from Sun back in 1997:
Block comments can start with /*-, which is recognized by indent(1) as the beginning of a block comment that should not reformatted.
    Taken from section 5.1.1 of Java Code Conventions

Now I'm pretty damn sure that Eclipse doesn't use indent for it's layout but I tried it anyway and it works a treat! Simply add the minus sign to the start of the block comment section and it will leave the whole block comment alone:
/*-
    
        
            XML which we don't want
        
        
    
*/