<?xml version="1.0" encoding="UTF-8" ?><taglib 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 web-jsptaglibrary_2_0.xsd"
version="2.0"> <description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri> <validator>
<description>
Provides core validation features for JSTL tags.
</description>
<validator-class>
org.apache.taglibs.standard.tlv.JstlCoreTLV
</validator-class>
</validator> <tag>
<description>
Catches any Throwable that occurs in its body and optionally
exposes it.
</description>
<name>catch</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
exception thrown from a nested action. The type of the
scoped variable is the type of the exception thrown.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
version="2.0"> <description>JSTL 1.1 core library</description>
<display-name>JSTL core</display-name>
<tlib-version>1.1</tlib-version>
<short-name>c</short-name>
<uri>http://java.sun.com/jsp/jstl/core</uri> <validator>
<description>
Provides core validation features for JSTL tags.
</description>
<validator-class>
org.apache.taglibs.standard.tlv.JstlCoreTLV
</validator-class>
</validator> <tag>
<description>
Catches any Throwable that occurs in its body and optionally
exposes it.
</description>
<name>catch</name>
<tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<description>
Name of the exported scoped variable for the
exception thrown from a nested action. The type of the
scoped variable is the type of the exception thrown.
</description>
<name>var</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
</tag>
</taglib>
解决方案 »
- tomcat index页问题
- quartz自身的表在创建的时候加了模式名,那么访问的时候怎么加模式名
- struts2 timeout的问题
- 生产者消费者问题。。 帮忙看看 代码
- 刚刚用struts写了一个程序,但是error的时候jsp显示不出来
- 坚持=必胜,写给我和我的同学们
- tomcat5.0.27+jdk1.4.2+axis1.4部署求教(The requested resource (/axis/) is not available.)
- 如何用Spring调存储过程.高手来解决下.在线等........
- 各位帮帮忙吧!我的XP装了J2EE1.4,但是只能编译,不能运行
- 我的tomcat服务器,为什么tomcat/classes里的文件都说找不到?
- 用JBuilder 2005如何编写Web Service客户端程序???
- xslt怎么用xsl:when?
只是一个标准的标签文件,我想在jsp页面里使用标签函数。
<?xml version="1.0" encoding="ISO-8859-1" ?>
<taglib 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 web-jsptaglibrary_2_0.xsd"
version="2.0">
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>function</short-name>
<uri>http://hellking.com/function</uri>
<display-name>JSTL sql RT</display-name>
<description>my function</description>
<function>
<name>add</name>
<function-class>com.jspdev.ch16.Function</function-class>
<function-signature>int add(int,int)</function-signature>
</function>
<function>
<name>trans</name>
<function-class>com.jspdev.ch16.Function</function-class>
<function-signature>java.lang.String trans(java.lang.String)</function-signature>
</function>
<function>
<name>formatPer</name>
<function-class>com.jspdev.ch16.PerUtil</function-class>
<function-signature>java.lang.String formatPer(float)</function-signature>
</function>
</taglib>
JSP应用开发详解(第二版)上有
在lib中导入那个jar包呢?
我的项目下已经导入了JSTL标签库
1。建立类Function package eldemo;import java.io.*;public class Function {
//中文转换
public static String tarns(String chi)
{
String result=null;
byte temp[]; try {
temp = chi.getBytes("iso-8859-1");
result = new String(temp);
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
return result;
}
//测试用
public static int add(int x,int y)
{
return x+y;
}
}
2。 建立func.tld,源码如下:
<taglib 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-jsptaglibrary_2_0.xsd"
version="2.0"> <tlib-version>1.0</tlib-version>
<short-name>function</short-name>
<uri>http://wq.com/function</uri>
<display-name>JSTL sql RT</display-name>
<description>my function</description> <function>
<name>add</name>
<function-class>eldemo.Function</function-class>
<function-signature>int add(int,int)</function-signature>
</function> <function>
<name>trans</name>
<function-class>eldemo.Function</function-class>
<function-signature>java.lang.String trans(java.lang.String)</function-signature>
</function>
</taglib>3。然后再web.xml上配置
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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" version="2.4">
<display-name>Demo</display-name>
<jsp-config>
<taglib>
<taglib-uri>http://wq.com/function</taglib-uri>
<taglib-location>/WEB-INF/func.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>4。可以直接调用(fun.jsp)
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib prefix="my" uri="http://wq.com/function" %>
<html>
<head>
<title>
MyFun
</title>
</head>
<body bgcolor="#ffffff">
<h1>
${my:add(10,20)}
</h1>
</body>
</html>