首先是Log_Tag.java:
package log;import javax.servlet.jsp.tagext.TagSupport;public class Log_Tag extends TagSupport {
private String log=""; public String getLog() {
return log;
} public void setLog(String log) {
this.log = log;
}
public int doStartTag(){
this.pageContext.getServletContext().log("Logging :" + log + "IP :" + this.pageContext.getRequest().getRemoteAddr());
return EVAL_BODY_INCLUDE;
}
}
然后是mylib.tld文件:
<?xml version="1.0" encoding="UTF-8"?><taglib version="2.0">
<description>My test tag lib</description>
<tlib-version>1.0</tlib-version>
<short-name>mylib</short-name>
<tag>
<name>log</name>
<tag-class>log.Log_Tag</tag-class>
<description>Logging.</description>
<attribute>
<name>log</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
最后是web.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 
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">
 <taglib>
  <taglib-uri>/mylib</taglib-uri>
  <taglib-location>/WEB-INF/lib/mylib.tld</taglib-location>
 </taglib>
</web-app>
上面红色标记为错误提示处,想请教各位高手,是哪个地方出错了?