Get an error when compiling Simple custom tag class









up vote
0
down vote

favorite












I am created simple Custom Tag Library. But When i run jsp I got en error below code. can anyone explain me the error.



Compiling 1 source file to C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedclasses
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
3 errors
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:953: The following error occurred while executing this line:
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:296: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)


XML code



<?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>lb1</short-name>
<uri>/WEB-INF/tlds/lb1</uri>
<tag>
<name>test</name>
<body-content>empty</body-content>
<tag-class>Test</tag-class>
</tag>
</taglib>


JSP code



<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="t" uri="/WEB-INF/tlds/lb1.tld"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<t:test/>
</body>
</html>


My Java class



 public class Test extends SimpleTagSupport

@Override
public void doTag() throws JspException, IOException
System.out.println("tag work");






Updated the question



I moved the java class to folder. but still got an error when compiling.



org.apache.jasper.JasperException:
file:C:/Users/Senani/Documents/NetBeansProjects/JSTL/build/web/index.jsp(17,8)
PWC6032: Unable to load tag handler class "Test" for tag "t:test"
org.apache.jasper.JasperException: PWC6032: Unable to load tag
handler class "Test" for tag "t:test"
C:/Users/Senani/Documents/NetBeansProjects/JSTL/build/web/index.jsp(17,8)
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:936:
Java returned: 1 BUILD FAILED (total time: 1 second)









share|improve this question



















  • 2




    Never, ever, ever use the default package.
    – JB Nizet
    Nov 10 at 14:19










  • I tried. but still occur an error. Update the question.@JBNizet
    – Poorna Senani Gamage
    Nov 10 at 15:32







  • 2




    You class needs to have a package statement, and you need to specify the fully quelified name in the XML file: folder.Test.
    – JB Nizet
    Nov 10 at 15:34










  • Yes...., It works.. Thank you sir,.@JBNizet
    – Poorna Senani Gamage
    Nov 10 at 16:32






  • 1




    @JBNizet Please add your comment as an answer. It's better to read an answer than a bunch of comments.
    – Roshana Pitigala
    Nov 11 at 4:48














up vote
0
down vote

favorite












I am created simple Custom Tag Library. But When i run jsp I got en error below code. can anyone explain me the error.



Compiling 1 source file to C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedclasses
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
3 errors
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:953: The following error occurred while executing this line:
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:296: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)


XML code



<?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>lb1</short-name>
<uri>/WEB-INF/tlds/lb1</uri>
<tag>
<name>test</name>
<body-content>empty</body-content>
<tag-class>Test</tag-class>
</tag>
</taglib>


JSP code



<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="t" uri="/WEB-INF/tlds/lb1.tld"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<t:test/>
</body>
</html>


My Java class



 public class Test extends SimpleTagSupport

@Override
public void doTag() throws JspException, IOException
System.out.println("tag work");






Updated the question



I moved the java class to folder. but still got an error when compiling.



org.apache.jasper.JasperException:
file:C:/Users/Senani/Documents/NetBeansProjects/JSTL/build/web/index.jsp(17,8)
PWC6032: Unable to load tag handler class "Test" for tag "t:test"
org.apache.jasper.JasperException: PWC6032: Unable to load tag
handler class "Test" for tag "t:test"
C:/Users/Senani/Documents/NetBeansProjects/JSTL/build/web/index.jsp(17,8)
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:936:
Java returned: 1 BUILD FAILED (total time: 1 second)









share|improve this question



















  • 2




    Never, ever, ever use the default package.
    – JB Nizet
    Nov 10 at 14:19










  • I tried. but still occur an error. Update the question.@JBNizet
    – Poorna Senani Gamage
    Nov 10 at 15:32







  • 2




    You class needs to have a package statement, and you need to specify the fully quelified name in the XML file: folder.Test.
    – JB Nizet
    Nov 10 at 15:34










  • Yes...., It works.. Thank you sir,.@JBNizet
    – Poorna Senani Gamage
    Nov 10 at 16:32






  • 1




    @JBNizet Please add your comment as an answer. It's better to read an answer than a bunch of comments.
    – Roshana Pitigala
    Nov 11 at 4:48












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am created simple Custom Tag Library. But When i run jsp I got en error below code. can anyone explain me the error.



Compiling 1 source file to C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedclasses
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
3 errors
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:953: The following error occurred while executing this line:
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:296: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)


XML code



<?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>lb1</short-name>
<uri>/WEB-INF/tlds/lb1</uri>
<tag>
<name>test</name>
<body-content>empty</body-content>
<tag-class>Test</tag-class>
</tag>
</taglib>


JSP code



<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="t" uri="/WEB-INF/tlds/lb1.tld"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<t:test/>
</body>
</html>


My Java class



 public class Test extends SimpleTagSupport

@Override
public void doTag() throws JspException, IOException
System.out.println("tag work");






Updated the question



I moved the java class to folder. but still got an error when compiling.



org.apache.jasper.JasperException:
file:C:/Users/Senani/Documents/NetBeansProjects/JSTL/build/web/index.jsp(17,8)
PWC6032: Unable to load tag handler class "Test" for tag "t:test"
org.apache.jasper.JasperException: PWC6032: Unable to load tag
handler class "Test" for tag "t:test"
C:/Users/Senani/Documents/NetBeansProjects/JSTL/build/web/index.jsp(17,8)
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:936:
Java returned: 1 BUILD FAILED (total time: 1 second)









share|improve this question















I am created simple Custom Tag Library. But When i run jsp I got en error below code. can anyone explain me the error.



Compiling 1 source file to C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedclasses
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
C:UsersSenaniDocumentsNetBeansProjectsJSTLbuildgeneratedsrcorgapachejspindex_jsp.java:85: error: cannot find symbol
Test _jspx_th_t_test_0 = (_jspx_resourceInjector != null) ? _jspx_resourceInjector.createTagHandlerInstance(Test.class) : new Test();
^
symbol: class Test
location: class index_jsp
3 errors
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:953: The following error occurred while executing this line:
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:296: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 2 seconds)


XML code



<?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>lb1</short-name>
<uri>/WEB-INF/tlds/lb1</uri>
<tag>
<name>test</name>
<body-content>empty</body-content>
<tag-class>Test</tag-class>
</tag>
</taglib>


JSP code



<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="t" uri="/WEB-INF/tlds/lb1.tld"%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<t:test/>
</body>
</html>


My Java class



 public class Test extends SimpleTagSupport

@Override
public void doTag() throws JspException, IOException
System.out.println("tag work");






Updated the question



I moved the java class to folder. but still got an error when compiling.



org.apache.jasper.JasperException:
file:C:/Users/Senani/Documents/NetBeansProjects/JSTL/build/web/index.jsp(17,8)
PWC6032: Unable to load tag handler class "Test" for tag "t:test"
org.apache.jasper.JasperException: PWC6032: Unable to load tag
handler class "Test" for tag "t:test"
C:/Users/Senani/Documents/NetBeansProjects/JSTL/build/web/index.jsp(17,8)
C:UsersSenaniDocumentsNetBeansProjectsJSTLnbprojectbuild-impl.xml:936:
Java returned: 1 BUILD FAILED (total time: 1 second)






java jstl custom-tags






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 4:43









Roshana Pitigala

4,53562346




4,53562346










asked Nov 10 at 14:11









Poorna Senani Gamage

8591921




8591921







  • 2




    Never, ever, ever use the default package.
    – JB Nizet
    Nov 10 at 14:19










  • I tried. but still occur an error. Update the question.@JBNizet
    – Poorna Senani Gamage
    Nov 10 at 15:32







  • 2




    You class needs to have a package statement, and you need to specify the fully quelified name in the XML file: folder.Test.
    – JB Nizet
    Nov 10 at 15:34










  • Yes...., It works.. Thank you sir,.@JBNizet
    – Poorna Senani Gamage
    Nov 10 at 16:32






  • 1




    @JBNizet Please add your comment as an answer. It's better to read an answer than a bunch of comments.
    – Roshana Pitigala
    Nov 11 at 4:48












  • 2




    Never, ever, ever use the default package.
    – JB Nizet
    Nov 10 at 14:19










  • I tried. but still occur an error. Update the question.@JBNizet
    – Poorna Senani Gamage
    Nov 10 at 15:32







  • 2




    You class needs to have a package statement, and you need to specify the fully quelified name in the XML file: folder.Test.
    – JB Nizet
    Nov 10 at 15:34










  • Yes...., It works.. Thank you sir,.@JBNizet
    – Poorna Senani Gamage
    Nov 10 at 16:32






  • 1




    @JBNizet Please add your comment as an answer. It's better to read an answer than a bunch of comments.
    – Roshana Pitigala
    Nov 11 at 4:48







2




2




Never, ever, ever use the default package.
– JB Nizet
Nov 10 at 14:19




Never, ever, ever use the default package.
– JB Nizet
Nov 10 at 14:19












I tried. but still occur an error. Update the question.@JBNizet
– Poorna Senani Gamage
Nov 10 at 15:32





I tried. but still occur an error. Update the question.@JBNizet
– Poorna Senani Gamage
Nov 10 at 15:32





2




2




You class needs to have a package statement, and you need to specify the fully quelified name in the XML file: folder.Test.
– JB Nizet
Nov 10 at 15:34




You class needs to have a package statement, and you need to specify the fully quelified name in the XML file: folder.Test.
– JB Nizet
Nov 10 at 15:34












Yes...., It works.. Thank you sir,.@JBNizet
– Poorna Senani Gamage
Nov 10 at 16:32




Yes...., It works.. Thank you sir,.@JBNizet
– Poorna Senani Gamage
Nov 10 at 16:32




1




1




@JBNizet Please add your comment as an answer. It's better to read an answer than a bunch of comments.
– Roshana Pitigala
Nov 11 at 4:48




@JBNizet Please add your comment as an answer. It's better to read an answer than a bunch of comments.
– Roshana Pitigala
Nov 11 at 4:48












1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










You get that error because you put your class in the default package.



Don't, ever do that. Use a proper package, and make sure to specify the fully qualified name of the class in the XML file.






share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239799%2fget-an-error-when-compiling-simple-custom-tag-class%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    You get that error because you put your class in the default package.



    Don't, ever do that. Use a proper package, and make sure to specify the fully qualified name of the class in the XML file.






    share|improve this answer
























      up vote
      2
      down vote



      accepted










      You get that error because you put your class in the default package.



      Don't, ever do that. Use a proper package, and make sure to specify the fully qualified name of the class in the XML file.






      share|improve this answer






















        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        You get that error because you put your class in the default package.



        Don't, ever do that. Use a proper package, and make sure to specify the fully qualified name of the class in the XML file.






        share|improve this answer












        You get that error because you put your class in the default package.



        Don't, ever do that. Use a proper package, and make sure to specify the fully qualified name of the class in the XML file.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 11 at 7:02









        JB Nizet

        528k51853986




        528k51853986



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239799%2fget-an-error-when-compiling-simple-custom-tag-class%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Barbados

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3