roger666888 2008-07-26 12:54
浏览 278
已采纳

<%@ taglib prefix="myfun" uri="http://hellking.co

[size=medium][color=red]<%@ taglib prefix="myfun" uri="http://hellking.com/function"%> [/color][/size]
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page contentType="text/html; charset=gb2312" language="java" %>
<%@ page isELIgnored ="false" %>


表达式语言的使用



提交的内容是:
${myfun:trans(param.name)}


另一个函数的使用,结果是:
${myfun:add(param["x"],param["y"])}


function函数如下:
package com.jspdev.ch16;
import java.io.*;
public class Function
{
public static String trans(String chi)
{
String result = null;
byte temp [];
try
{
temp=chi.getBytes("iso-8859-1");
result = new String(temp);
}
catch(UnsupportedEncodingException e)
{
System.out.println (e.toString());
}
return result;
}
public static int add(int x,int y)
{
return x+y;
}
}

在第一行下面有如下错误提示:Cannot find the tag librar descriptor for http://hellking.com/function。请问高人们怎么解决?谢谢!

  • 写回答

1条回答 默认 最新

  • aidiyuxin 2008-07-26 15:23
    关注

    [size=medium][code="java"]<%@ taglib prefix="myfun" uri="http://hellking.com/function"%> [/code]
    你配它的tld了吗?
    taglib中的uri必须要和tld中的一直
    ps:
    也可以在web.xml里配置下,可以简化taglib中的uri
    如:
    [code="java"]
    <!--配置JSTL-->

    jstl/core
    /WEB-INF/tld/c.tld

    [/code][/size]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?