views:

162

answers:

2

I've seen this kind of issue on SO (and on the Net overall) quite a few times. For example here:

http://stackoverflow.com/questions/1884529

Earlier today I was trying on a JSP (regular .jsp, not .jspx) to do this, because I stupidly cut/pasted some example found on the net:

<%@ taglib prefix = "c" uri = "http://java.sun.com/jstl/core"%&gt;

Then my .jsp was giving a blank page. No error message in the Tomcat log. No nothing. Just a blank page.

While, of course (I'm being sarcastic here), the correct line was this:

<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%&gt;

There was a "jsp/" missing (which I found a hint to in yet another SO question).

So obviously such issues are common.

I can't believe you have to wait for things "not to work" to know you've there's an error and I'm honestly a bit confuzzabled by the number of questions found on the net (and here on SO) where the answer is basically "fix your declaration".

My question here is simple: how do you know that it's a declaration issue? What thought process is required here to diagnose and troubleshoot such issues? Are there tools that can help here? (I don't know, like, say, IntelliJ IDEA or Eclipse or Emacs in nxml-mode warning you in real time that the declared URI is invalid?)

+1  A: 

View page source in webbrowser, if you see the tags unparsed, then the taglib is not found/loaded.

I am not sure if I understand your last statement, but Eclipse errors here with a red line if the taglib is not found in classpath.

BalusC
@BalusC: oh my... I just took over some projects (not mine) and made a few trivial fix left and right. I didn't notice my IDE had no .jsp support at all :) Then I like very much the *"view source"* trick regarding unparsed tags!
Webinator
You're welcome.
BalusC
+1  A: 

http://java.sun.com/jstl/core is a valid JSTL declaration - it is the URI for JSTL core 1.0. http://java.sun.com/jsp/jstl/core is the URI for JSTL core 1.1.

McDowell
@McDowell: +1... surely something like *...sun.com/jstl/core10* and *...sun.com/jstl/core11* would have been more, well, consistent :) Maybe for JSTL core 1.2 it's going to be *http://java.sun.com/web/jsp/jstl/core* or something :)
Webinator