在eclipse开发自定义标签问题!package tagPackage;
import java.io.*;
import javax.jsp.JspException;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.jstl.*;
public class FileTag extends TagSupport{}
错误提示:
TagSupport cannot be resolved to a type
the import javax.servlet.jsp.tagext cannot be resolved to a type该怎么解决?我已经把JSTL.jar 包加入到了eclipse中了,是否还要加入其他的包?
import java.io.*;
import javax.jsp.JspException;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.jstl.*;
public class FileTag extends TagSupport{}
错误提示:
TagSupport cannot be resolved to a type
the import javax.servlet.jsp.tagext cannot be resolved to a type该怎么解决?我已经把JSTL.jar 包加入到了eclipse中了,是否还要加入其他的包?
解决方案 »
- 关于java Map containsValue的问题,紧急求助
- 一个简单的登陆问题?
- sh框架的structs-config.xml报错
- 整理一下ireport+jasperreports报表,对初学的朋友希望有所帮助······
- 谁有需求分析文档,给个下载地址也可以,另外高分相送500分
- 请教个问题
- 为什么没有检证我输入的字符................
- 运行jsp程序,第一个页面的form表单中action到第二个页面中,使用get想得前一页的值...?
- weblogic 怎么回事?
- 面试索贝的梦幻经历
- 随即数问题,帮忙看下这个随即数会不会重复的?
- 为什么我的系统在服务器上面运行总报java.lang.ArrayIndexOutOfBoundsException?
你可以在tomcat的common/lib目录下找到这个包。制作简单的taglib,可以参考我们教程中的例子:http://www.family168.com/tutorial/jsp/html/jsp-ch-09.html
package regtld;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspWriter;
import properties.RegProperties;
public class Protld extends TagSupport {
private String temp;
public void setTemp(String temp){
this.temp=temp;
}
public int doEndTag() throws JspException {
// TODO 自动生成方法存根
JspWriter out=pageContext.getOut();
try{
//new RegProperties().getProperties(temp)自定义的一个从register.properties文件中读取数据的类方法
out.print(new RegProperties().getProperties(temp));
}catch(Exception e){
System.err.println(e);
}
return super.doEndTag();
}
}
foot.jsp
<%@page pageEncoding="GB2312"%>
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib uri="/reg" prefix="reg" %>
<table width="800" border="1" align="center" bordercolor="#FF9900">
<tr>
<td height="20" bgcolor="#FF9900"> </td>
</tr>
<tr>
<td height="100" align="center" valign="middle" bgcolor="#F0F0F0"><p>版权所有:
<reg:protld temp="copyright" /></p>
<p>技术支持:<reg:protld temp="designer" /></p></td>
</tr>
</table>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Register</display-name>
<description>design by xiang</description> <welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<taglib>
<taglib-uri>/reg</taglib-uri>
<taglib-location>/WEB-INF/tld/reg.tld</taglib-location>
</taglib>
</web-app>标签库reg.tld
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>tld</short-name>
<uri>/reg</uri>
<tag>
<name>protld</name>
<tagclass>regtld.Protld</tagclass>
<bodycontent>empty</bodycontent>
<info>Display title</info>
<attribute>
<name>temp</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
<type>String</type>
</attribute>
</tag>
</taglib>以前做的一个实验的例子
希望对你有帮助同楼上
制作taglib并不需要jstl.jar