Adding a custom attribute to an existing tag

Posted on 2011-04-21
Last Modified: 2012-05-11

I have a jsp file with an inputText tag that looks like this:

 <h:inputText styleClass="inputText" id="objectname" required="true" value="#{msg.objectname}" maxlength="50" onblur="validateRequired(this, event);">

I have a handler that looks at the class and if a specific word is found there, then it does some action.  I would like to add to the action by looking for an attribute say "myAttr" and then do something else if that is set. For instance, I want to be able to do this:

 <h:inputText styleClass="inputText" myAttr="showdetails" id="objectname" required="true" value="#{msg.objectname}" maxlength="50" onblur="validateRequired(this, event);">

When I do this however, I get an exception:

Error Message:JSPG0227E: Exception caught while translating /jsp/view/MySpecialForm.jsp:  /jsp/view/MySpecialForm.jsp(311,19) --> JSPG0123E: Unable to locate tag attribute info for tag attribute myAttr.

How can I add my attribute without causing an exception? Is this possible?
Question by:bganoush
    LVL 75

    Accepted Solution

    why not
    styleClass="inputText showDetails"

    Author Comment


    Thanks I'll try that.

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Suggested Solutions

    Title # Comments Views Activity
    decryption not working 5 73
    Can't get intermediate Certificate to work in Tomcat 9 94
    JSP Popup page 2 82
    withoutString  challenge 40 119
    After several days of searching and hunting for limited documentation, I wanted to share this guide to hopefully save someone the hassle of trying to figure this out on their own. I have tested this on Xendesktop 7.1 and PS 4.5 running simultaneous…
    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now