
2007-08-14 - Charleston, South Carolina
I like how the lady is unsuspectingly in the picture. This Gazebo was cool and down past "Rainbow Row".
Today had been a majorly frustrating day with learning how to use JSPs the “right” way.
List moviesList = new ArrayList();
moviesList.add("Top Gun");
moviesList.add("Terminator");
request.setAttribute("movieList", moviesList);
<table>
<c:forEach var="movie" items="${movieList}" >
<tr>
<td>${movie}</td>
</tr>
</c:forEach>
</table>
First off Tomcat wasn’t really working and I couldn’t figure out why. This had led me down the road to using Glassfish for a while, but I wanted to try and steer clear due to previous scars I still have from using Glassfish.
In Tomcat, it turns out had I had setup the password to be different than our other computer and that was throwing me off. After that, it still wouldn’t launch because it got a file not found (invalid permissions) error. So, i did a sudo chmod -R +x apache-tomcat-6.0.20 and finally it started up! Now, after all this I tried to run some of the samples and found that there were not sufficient permissions for the tomcat directory. So I said screw it and did a chmod 777. I know that’s the worst thing in the world, but hey, it works, right?
So now I could run the example jsp pages that used Tags, but I couldn’t get my pages to work. Frustration! Luckily mid-day I decided to go grab my book (picture shown above) that helped break down JSP tags for me. It recommended to copy the jslt.jar and standard.jar files from the examples into my /WEB-INF/lib directory. That seemed like it should be easy enough. It was easier than looking digging for the libraries in the global Maven repositories (searches that were coming up empty), however it still wouldn’t work. Total frustration!!!
Now, it’s confusing enough that when there seems to be specific implementations of the JSTL (Java Standard Tag Library) for each container i.e. Tomcat, Glassfish, etc. But now I was using the Tomcat Libraries, on Tomcat and the same exact libraries that the samples were using. What gives?? Why isn’t it working?
Finally, after a clear head from the gym and a plan of action I came back and pieced things together piece by piece.
The culprit… well a lot of things it seems, but it all came down to one attribute.
FAIL.web.xml file: |
WIN!web.xml file:
|
What??? Just a version number? All of my web.xml files had been machine generated so that was the last place I looked. At least I got to the bottom of it and can move on to actually using JSP Tags in the morning.
Lesson of the day: Use a version number in your web.xml file. It’s obviously important.