My web.xml doesn't know the taglib tag
3 answers
Tags
<taglib>
must be inside the tag <jsp-config>
.
But using Struts2
, you absolutely don't need the struts-html
taglib, it's from Struts 1, which is older and completely different.
Just browse through the features Struts2
and you will find that you no longer need to use html tags, thankfully.
+3
source to share
There are three ways to customize a tag library.
- Manual throw setting
web.xml
: Make sure the tld files are copied to the folderWEB-INF
, set themweb.xml
as below, use the taglib attribitete attribute in the taglib directive like<%@ taglib uri="mytagliburi" prefix="ww" %>
.
...
<taglib>
<taglib-uri>mytagliburi</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
- Manual configuration with directive only
taglib
. Make sure the tld files are copied to the folderWEB-INF
and configure directly in the taglib directory as<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="ww" %>
. - Automatic setting . This is an easy way and is used in Struts version 1.2, just include it
struts-taglib.jar
in the projectclasspath
or copy it to a folderWEB-INF/lib
. All details aretld
defined inside the folderstruts-taglib.jar\META-INF\tld
. During deployment, all tlds will be deployed automatically. However, we can only access it using the namepre-fixed uri
. In this method, we cannot change the nametaglib uri
.
0
source to share