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 71793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:56:37+00:00 2026-05-10T19:56:37+00:00

I’m having trouble with a custom tag:- org.apache.jasper.JasperException: /custom_tags.jsp(1,0) Unable to find setter method

  • 0

I’m having trouble with a custom tag:-

org.apache.jasper.JasperException: /custom_tags.jsp(1,0) Unable to find setter method for attribute : firstname

This is my TagHandler class:

package com.cg.tags;  import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.TagSupport;  public class NameTag extends TagSupport{      public String firstname;     public String lastname;      public void setFirstName(String firstname){          this.firstname=firstname;         }     public void setLastName(String lastname){          this.lastname=lastname;         }      public int doStartTag() throws JspException {         try {             JspWriter out=pageContext.getOut();             out.println( 'First name:  '+firstname+ 'Last name: '+lastname);          } catch (Exception ex) {             throw new JspException('IO problems');         }         return SKIP_BODY;     }   } 

This is my TLD file:

?xml version='1.0' encoding='UTF-8'?> <taglib>      <tlibversion>1.1</tlibversion>      <jspversion>1.1</jspversion>      <shortname>utility</shortname>      <uri>/WEB-INF/nametagdesc.tld</uri>      <info>        A simple tag library for the examples      </info>    <tag>        <name>name</name>        <tagclass>com.cg.tags.NameTag</tagclass>        <bodycontent>empty</bodycontent>       <attribute>       <name>firstname</name>       <required>true</required>       <rtexprvalue>true</rtexprvalue>       </attribute>       <attribute>       <name>lastname</name>       <required>true</required>       <rtexprvalue>true</rtexprvalue>     </attribute>  </tag> </taglib> 

And this is my JSP page:

<%@ taglib uri='/WEB-INF/nametagdesc.tld' prefix='cg'  %>  <cg:name firstname='fname' lastname='lname'/> 

I have checked that the code is recompiled and deployed correctly etc etc….

So, the question is , why can’t it find the setter method???

  • 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. 2026-05-10T19:56:37+00:00Added an answer on May 10, 2026 at 7:56 pm

    Check the case of the attributes in your tag element – they should match the case of the setter, not the case of the member variables (Which should probably be private, by the way).

    The rule is that the attribute name has its first letter capitalised and then the result is prefixed by ‘set’, to arrive at the setter name.

    In your case, you’ve called the attribute 'firstname', so the rule results in the the JSP compiler looking for the ‘setFirstname’ method. As you’ve named your setter 'setFirstName' (with a capital ‘N’), you should use 'firstName' (Also with a capital ‘N’) for the attribute name.

    Apply the same rule to the 'lastname' attribute, to arrive at 'lastName', and you should be in business.

    P.S. Using a good IDE, like IntelliJ, would have helped in this case, as it would have suggested the valid names for your attributes, saving you a lot of head scratching.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.