Get an error when compiling Simple custom tag class
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
add a comment |
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
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
add a comment |
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
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
java jstl custom-tags
edited Nov 11 at 4:43
Roshana Pitigala
4,63162348
4,63162348
asked Nov 10 at 14:11
Poorna Senani Gamage
8841921
8841921
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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',
autoActivateHeartbeat: false,
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered Nov 11 at 7:02
JB Nizet
534k51859993
534k51859993
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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