Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在doStartTag函数中获取JSP TLIB的自定义标记名_Java_Jsp_Tags_Taglib_Custom Tag - Fatal编程技术网

Java 在doStartTag函数中获取JSP TLIB的自定义标记名

Java 在doStartTag函数中获取JSP TLIB的自定义标记名,java,jsp,tags,taglib,custom-tag,Java,Jsp,Tags,Taglib,Custom Tag,我需要在doStartTag函数中获取请求者标记的名称 我在.tld中有这个自定义标记 <tag> <name>Resource</name> <tag-class>Mirnint.Interface.Tag.MNIT_Resources</tag-class> <body-content>JSP</body-content> <attribute> &

我需要在doStartTag函数中获取请求者标记的名称 我在.tld中有这个自定义标记

<tag>
    <name>Resource</name>
    <tag-class>Mirnint.Interface.Tag.MNIT_Resources</tag-class>
    <body-content>JSP</body-content>
    <attribute>
        <name>Style</name>
        <required>false</required>
    </attribute>
    <attribute>
        <name>JavaScript</name>
        <required>false</required>
    </attribute>
</tag>
你的输出应该是

Resource

感谢您的帮助…

您需要创建一个与name对应的getter/setter;那么您的代码如下所示:

public class Hello extends TagSupport {
    private String name=null;
    /**
      * Getter/Setter for the attribute name as defined in the tld file 
      * for this tag
      */
public void setName(String value){
    name = value;
}

    public String getName(){
          return(name);
       }
/**
* doStartTag is called by the JSP container when the tag is encountered
*/
    public int doStartTag() {
    System.out.println(name);
    }

我需要的是标签的名称,而不是属性“Name”的值。。。标签名称这个程序的输出是什么,你能把它贴在这里吗?
Resource
public class Hello extends TagSupport {
    private String name=null;
    /**
      * Getter/Setter for the attribute name as defined in the tld file 
      * for this tag
      */
public void setName(String value){
    name = value;
}

    public String getName(){
          return(name);
       }
/**
* doStartTag is called by the JSP container when the tag is encountered
*/
    public int doStartTag() {
    System.out.println(name);
    }