Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6235285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:38:37+00:00 2026-05-24T10:38:37+00:00

I am defining a custom tag htmlencoder. I have These files: WEB-INF/classes/HtmlEncoderTag.jar ,with a

  • 0

I am defining a custom tag “htmlencoder”. I have These files:

WEB-INF/classes/HtmlEncoderTag.jar ,with a java code like this:

import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;
public class HtmlEncoderTag extends BodyTagSupport{
    //....
}

WEB-INF/htmlencoder.tld :

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
        "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
  <tlib-version>1.0</tlib-version>
  <jsp-version>1.2</jsp-version>
  <short-name></short-name>
 <tag>
    <name>htmlencode</name>
    <tag-class>HtmlEncoderTag</tag-class>
    <body-content>JSP</body-content>
  </tag>
</taglib>

index.jsp:

<%@ taglib uri="WEB-INF/htmlencoder.tld" prefix="htmlencoder"%>
<head>
  <title>Watch out you sinners...</title>
</head>
<html>
  <body bgcolor="white">
    <htmlencoder:htmlencode><script <% //the error refers to this line %>
      type="javascript">BadStuff()</script></htmlencoder:htmlencode>
  </body>
</html>

I got the error “HtmlEncoderTag cannot be resolved to a type” when i run my page and it shows me the line index.jsp:7 ( I mentioned above).

What should I do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:38:38+00:00Added an answer on May 24, 2026 at 10:38 am

    I found the answer. I’m not sure it is necessary, but my problem solved this way:
    You have to put your tag class in a package. for example, your HtmlEncoderTag.jar file should be placed in WEB-INF/MyTag/ and should be like this:

    pckage MyTag;
    import java.io.IOException;
    import javax.servlet.jsp.JspException;
    import javax.servlet.jsp.tagext.BodyContent;
    import javax.servlet.jsp.tagext.BodyTagSupport;
    public class HtmlEncoderTag extends BodyTagSupport{
        //....
    }
    

    And your tld file will be like this:

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib
            PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
            "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>1.0</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name></short-name>
     <tag>
        <name>htmlencode</name>
        <tag-class>MyTag.HtmlEncoderTag</tag-class>
        <body-content>JSP</body-content>
      </tag>
    </taglib>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a custom LISP interpreter. It won't support defining functions like in
So I have a custom view set up in code (no XML layout defined
I'm defining my custom model for pas.plugin.sqlalchemy. Existing table of login details have binary
I tried defining a structure with a custom print function and constructor like so:
I Have a ListBox and I am defining its ItemsTemplate using a custom control.
I don't really like the idea of defining user required pages in the web.config,
Defining custom components in Facelets is easy and quick but there's one thing I
When defining a custom operator from the limited set of single-character operators that can
Is including a application package prefix while defining a custom action string is convention
When defining a method on a class in Python, it looks something like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.