天天看點

struts2标簽找不到解決方案

jsp頁面中引用出現:

<%@ taglib prefix="s" uri="/struts-tags" %>

<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

1 缺少/struts-tags

2 缺少/struts-dojo-tags

在xp上不用直接指定這些檔案的位置,但在其他的系統可能無法自動找到它的路徑,一定要明确指定

在web.xml中配置:

<taglib>

<taglib-uri>/struts-tags</taglib-uri>

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

</taglib>

<taglib>

<taglib-uri>/struts-dojo-tags</taglib-uri>

<taglib-location>/WEB-INF/struts-dojo-tags.tld</taglib-location>

</taglib>

在struts的包的META-INF中把檔案copy出來到/WEB-INF/下

做以上修改後,系統可正常使用。

這個有時候可以搜到,但是有時候會jsp程式設計中報錯,為拉更好的避免這個,采取上面的方法是指明路徑,移植性達到最優.