java - custom tag in jsp not responding -


i facing problem while using custom tags in jsp. application running well, tag not responding. code is:

this index.jsp , working. *index.jsp*

<%@page contenttype="text/html" pageencoding="utf-8"%> <%@taglib uri="/web-inf/mytaglib" prefix="mtl"%> <!doctype html> <html>    <head>         <meta http-equiv="content-type" content="text/html; charset=utf-8">         <title>jsp page</title>     </head>     <body>        code is:<mtl:mytagclass input="goodmorning" start="1" end="6"/>     </body> </html> 

this tag library *mytaglib.tld*

<?xml version="1.0" encoding="utf-8"?> <taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">   <tlib-version>1.0</tlib-version>   <short-name>mtl</short-name>   <uri>/web-inf/mytaglib</uri>    <tag>     <name>mytagclass</name>     <tag-class>mypack.mytagclass</tag-class>     <body-content>empty</body-content>     <attribute>       <name>input</name>       <required>true</required>       <rtexprvalue>true</rtexprvalue>      <type>java.lang.string</type>     </attribute>     <attribute>        <name>start</name>       <required>true</required>       <rtexprvalue>true</rtexprvalue>       <type>java.lang.string</type>     </attribute>     <attribute>       <name>end</name>       <required>true</required>       <rtexprvalue>true</rtexprvalue>       <type>java.lang.string</type>     </attribute>   </tag> </taglib> 

following tag handler *mytagclass.java*

package mypack;  import javax.servlet.jsp.jspwriter; import javax.servlet.jsp.jspexception; import javax.servlet.jsp.tagext.jspfragment; import javax.servlet.jsp.tagext.simpletagsupport;  public class mytagclass extends simpletagsupport {     private string input=null;     private string start=null;     private string end=null;   public mytagclass(){}     @override     public void dotag() throws jspexception {         jspwriter out = getjspcontext().getout();          try {             jspfragment f = getjspbody();             if (f != null) {                 f.invoke(out);                 out.println("input.substring(start,end)");            } } catch (java.io.ioexception ex) {            throw new jspexception("error in mytagclass tag", ex);        }     }      public void setinput(string input) {         this.input = input;     }      public void setstart(string start) {         this.start = start;     }      public void setend(string end) {         this.end = end;     }  } 

n dis web.xml *web.xml*

<?xml version="1.0" encoding="utf-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">         <session-config>         <session-timeout>             30         </session-timeout>     </session-config>     <welcome-file-list>         <welcome-file>index.jsp</welcome-file>     </welcome-file-list>     <jsp-config>         <taglib>              <taglib-uri>/web-inf/mytaglib</taglib-uri>             <taglib-location>/web-inf/mytaglib.tld</taglib-location>         </taglib>     </jsp-config> </web-app> 

please help

i suggest refer following link better understanding customer tag implementation process demo


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -