开发者

Java: how to debug an invalid JSTL declaration?

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

JSPX namespaces not visible for EL functions?

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"%>

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"%>

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?)


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜