maven中jstl標籤,struts2標籤庫報錯問題解決方案

錯誤信息如下:

1. The absolute uri:[http://java.sun.com/jsp/jstl/core] cannot be resolved in either web.xml or the jar files deployed with this application

2. Unable to find taglib "s" for URI: /struts-tags

(由於本人已解決該錯誤,該圖片來源於https://blog.csdn.net/baidu_32377671/article/details/78433474

èµæºæ¥é

① jstl標籤解決方案:

1. 導入jstl (注意版本問題)

<!-- jstl -->
<dependency>
	<groupId>jstl</groupId>
	<artifactId>jstl</artifactId>
	<version>1.2</version>
</dependency>

如果導入的jstl版本爲1.2,則不用再導入standard包,因爲1.2中已經包含了standard包。

如果jstl版本爲1.1.2,則需要導入standard.1.1.2包。

2. 找到jar包下的META-INF文件夾下的c.tld文件,將其複製到項目的webapp/WEB-INF文件夾下即可。

3. 一般情況上述步驟足以解決,如果不可以,再配置web.xml

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

② struts2標籤庫問題解決

1. 導入struts2-core.jar包依賴(此處版本鎖定爲:<struts.version>2.3.24</struts.version>)

<dependency>
	<groupId>org.apache.struts</groupId>
	<artifactId>struts2-core</artifactId>
</dependency>

2. 將該包下的struts-tags.tld文件複製到項目的webapp/WEB-INF文件夾下即可。

3. 如果問題沒有解決,配置web.xml

<jsp-config>
    <taglib>
        <taglib-uri>/struts-tags</taglib-uri>
        <taglib-location>/WEB-INF/struts-tags.tld</taglib-location>
    </taglib>
</jsp-config> 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章