J2EE encompasses a bunch of different technologies (or, more precisely, specifications for technologies), for all the different layers of an application. It includes servlets, JDBC, JSP, EJB, JMS, etc. There's also an overall notion of how these pieces should work together. Sun promotes the idea that you have to take the entire package, all-or-nothing. But this isn't true: some people use everything but substitute a different view technology for JSP. On other hand, most people using Spring still use JDBC and Servlets.
In principle since various alternatives have to solve the same problems, there will be some ideas that carry over. But in many cases the details a different enough that transisitioning from one to the next won't be that much easier than started from scratch, at least the first time you do it. (After you've done it a few times, it gets easier, just like learning your fourth foreign language is easier than learning your second.)
So what to learn first? I think some of the J2EE alternatives like Hibernate and Spring are simpler and therefore probably easier to learn. On the other hand there is less choice for books and other learning material.