This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The JSP expressions <%= ... %> are placed inside a out.print()
So <%= state ? "yes" : "no" %> is converted into out.println(state ? "yes" : "no");, which compiles without any problem. But with the if-statement the resulting code won't compile. That's also why semicolon in a jsp expression is not allowed.