tags:

views:

36

answers:

1

Does the order of the imports in a JSP page matter? I have a JSP page that worked just fine in JBoss 4, but is not compiling in JBoss 6. These are the imports:

<%@ page import="com.at.enp.SecurityManager,
        com.at.enp.util.webUtil,
        com.at.vb.mod.fa.db.RPData.ResetOption,
        com.at.enp.modules.loyalty.MetricSetting,
        java.util.List,
        com.at.presentation.security.EFRightsGroup,
        com.at.enp.modules.loyalty.BonusPlanHandler,
        com.at.presentation.bean.ef.RewardType,
        java.text.SimpleDateFormat,
        com.at.util.*"%>

The offending import is : com.at.vb.mod.fa.db.RPData.ResetOption ResetOption is a public class inside of RPData. If I move the import down in the import list the page compiles just fine. I have no idea why that is making a difference. Any help would be appreciated.

+1  A: 

To my knowledge, the order of import statements in a Java class does not matter, so it shouldn't matter in the JSP too. However, I've seen JVM bugs like 6431987 and 6391197 about import order (the former being the closest to your case). Could you be affected by such a bug?

Pascal Thivent
Wow, nasty bug. I think IDE's auto-ordering of imports in **normal Java classes** has taken care that I've never seen this bug before. One more reason why scriptlets are treacherous ;)
BalusC
@BalusC Can't agree more. And it's really a nasty one as the problem [may not occur under Eclipse](http://unimplemented.blogspot.com/2007/08/my-java-puzzle-does-order-of-import.html), causing big headache. I would just hate to loose time on that one.
Pascal Thivent
My comment is somehow stupid since it's a *Sun JVM* bug :)
Pascal Thivent