Tag Archives: Maven

Maven and JPA Programming

I wanted to take a moment to rant a little about Maven and JPA programming. If you haven’t switched to the Maven way of things (It took me years to give into the dark side!) or you just started doing Maven-ized projects recently, you might still be getting the hang of things.

I won’t lie: it can be relatively hard to get used to. For example, take a look at the traditional directory structure for your project:

standard Maven directory layout

This may look a bit complex (like the first time you looked at a Unix directory structure!?) but in fact it’s a fantastic convention. For example, it’s so amazingly easy for me to create sample data files, drop them into src/test/resources/sampleData and then pull the data will a quick Unit Test using

InputStream sampleData = getClass().getResourcesAsStream("/sampleData/myFile");

and away you go! Continue reading

Running JSTL 1.2 on Tomcat 7 using Maven

Okay, I know I haven’t posted anything on my blog in over a year, but this falls under the OMG-Why-Couldn’t-I-find-a-straightforward-answer category. Whomever suffers the same headache I suffered will hopefully get led here by Google…

The Problem: Running the most basic JSP Example

Up until now, the few times I’ve needed to cobble together a JSP file for some sort of front-end functionality, I’ve used raw, low-level JSP Scriptlets. Which means typing things like

<% if (something) { %> <some-html> <% } else { %> <some-html> <% } %>

all over the place. And if I wanted to do any looping, well forget about it! It’s a nightmare. So I’ve got these few books and articles that talk about the better ways to solve these problems using cleaner xml-y solutions, and most all of them dive into using JSTL (JSP Standard Tag Library) which is a damned standard and yet isn’t included with Tomcat. It’s one of those things that each vendor is supposed to implement independently, and yet the only implementation out there appears to be Oracle’s Glassfish implementation! (There’s an Apache JSTL project, and they say on their web page that a version 1.2 implementation (which is the stated version for the Java 6 EE standard collection, alongside Servlet 3.0 and JSP 2.2) but that webpage hasn’t been updated since October 2009!!

So apparently JSTL is so basic and simple that it’s included in the elementary pages of any JSP books, but like some bastard stepchild that nobody wants, it’s support is freakishly missing. Okay, enough bellyaching about how FUBAR that is… what about just getting the thing to run? Continue reading