package cn.itcast.web.el;
public class ElUtils {
public static String subString(String source,int length){
if(source.length()>length){
return source.substring(0, length) + "......";
}
return source;
}
}
<?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 http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>A tag library exercising SimpleTag handlers.</description>
<tlib-version>1.0</tlib-version>
<short-name>SimpleTagLibrary</short-name>
<uri>/WEB-INF/itcast</uri>
<function>
<name>subString</name>
<function-class>cn.itcast.web.el.ElUtils</function-class>
<function-signature>java.lang.String subString(java.lang.String,java.lang.Integer)</function-signature>
</function>
</taglib>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="/WEB-INF/itcast" prefix="itcast"%>
严重: Servlet [listcustomer] in web application [/day15_customer] threw load() exception
org.apache.jasper.JasperException: Method "subString" for function "subString" not found in class "cn.itcast.web.el.ElUtils"
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:55)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:277)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:75)
at org.apache.jasper.compiler.Validator$ValidateVisitor$1MapperELVisitor.visit(Validator.java:1751)
at org.apache.jasper.compiler.ELNode$Function.accept(ELNode.java:139)
at org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:214)
at org.apache.jasper.compiler.ELNode$Visitor.visit(ELNode.java:256)
at org.apache.jasper.compiler.ELNode$Root.accept(ELNode.java:61)
at org.apache.jasper.compiler.ELNode$Nodes.visit(ELNode.java:214)
at org.apache.jasper.compiler.Validator$ValidateVisitor.getFunctionMapper(Validator.java:1760)
at org.apache.jasper.compiler.Validator$ValidateVisitor.getJspAttribute(Validator.java:1416)
at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1231)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:879)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1536)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:898)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1536)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:898)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1536)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:898)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1536)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:464)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1853)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:219)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:358)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:338)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:325)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:580)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:138)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1227)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1140)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1027)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5037)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5347)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)