關於JSTL一些需要說明的

來源:互聯網
上載者:User

標籤:apach   統一   j2ee   ror   erro   uri   1.5   ash   從零開始   

  一直認為與.NET相比,JAVA最大的問題在於不統一,當然這可能是自由的代價,正如某某某一樣,造成的結果是需要記各種各樣的版本,有jsp的、servlet的、各種架構的、各種容器的,不一而足。今天要說的是JSTL。關於JSTL的版本問題本來一直認為這不是問題,但是今天在部署的時候恰恰成了問題。中午剛剛做完一個小程式,往伺服器上一發布,直接來了一堆錯誤,如下:

HTTP Status 500 - javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/core/SetTag

  看到這個錯誤,我只能得出是標籤庫引起的,趕緊查查有沒有哈,緊接著就上部署網站的“WEB-INF\lib”去找,看有沒有JSTL包:

taglibs-standard-impl-1.2.5.jar(實現)taglibs-standard-spec-1.2.5.jar (規範)

以前版本是:

jstl.jar

standard.jar

 一看還真有,那是?想不出來,最後沒辦法,但是基本上可以斷定是版本問題,沒辦法,從零開始:

1)將TOMCAT下的web.xml檔案拷貝出來,擷取標頭檔定義:

 

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"

 

以前的是:

<!-- <web-app xmlns="http://java.sun.com/xml/ns/j2ee" --><!--     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" --><!--     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" --><!--     version="2.4"> -->

 

繼續加入web.xml中加入JSTL配置:

<jsp-config>    <taglib>     <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>     <taglib-location>/WEB-INF/c.tld</taglib-location>    </taglib> </jsp-config>

 

重啟TOMCAT,OK,搞定。

 

網上還有其他網友也遇到了類似的問題,感興趣的可以一起看看:

http://oldbig.iteye.com/blog/2240432

http://blog.sina.com.cn/s/blog_6f3ef5c20101ar86.html

關於JSTL一些需要說明的

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.