解决Unable to find taglib [cr] for URI: [WBE-INF/tlds/testlib.tld]] with root cause的可能性方案
生活随笔
收集整理的這篇文章主要介紹了
解决Unable to find taglib [cr] for URI: [WBE-INF/tlds/testlib.tld]] with root cause的可能性方案
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
最近在學習自定義JSP標簽,按照網上的例程敲了一下發現出現500錯誤,錯誤信息Unable to find taglib [cr] for URI: [WBE-INF/tlds/testlib.tld]] with root cause
反復檢查了Tomcat/logs中的信息和自己的配置路徑確認沒有問題之后,偶然想到可能是版本不同(網上的例程版本已經比較老了),然后打開Tomcat提供的example文件之后發現果然書寫格式有許多不一樣,接下來直接貼出對比:
存在問題的tld文件定義方法:
<?xml version="1.0" encoding="ISO-8859-1" ?> <!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements. See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. --> <!DOCTYPE taglibPUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN""http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd"> <taglib><tlibversion>1.0</tlibversion><jspversion>1.2</jspversion><shortname>challen</shortname><tag><name>cr</name><tagclass>com.challen.jsp.CopyRightTag</tagclass><bodycontent>empty</bodycontent><attribute/></tag> </taglib>修改后可行的代碼: <?xml version="1.0" encoding="ISO-8859-1" ?> <!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements. See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. --> <!DOCTYPE taglibPUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN""http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd"> <taglib><tlib-version>1.0</tlib-version><jsp-version>1.2</jsp-version><short-name>challen</short-name><tag><name>cr</name><tag-class>com.challen.jsp.CopyRightTag</tag-class><body-content>empty</body-content><attribute/></tag> </taglib>
正如經常看到的那句話,MVC架構目前還沒有一個成熟的理論或是模式給人們去學習,大家只能通過現有的例程去感受MVC設計思想一樣,在遇到問題的時候,去提供的例程里尋找答案也是不錯的選擇!
共勉!
總結
以上是生活随笔為你收集整理的解决Unable to find taglib [cr] for URI: [WBE-INF/tlds/testlib.tld]] with root cause的可能性方案的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux下的字符设备驱动
- 下一篇: xshell如何运行java_利用Xsh