We help IT Professionals succeed at work.

Adding a custom attribute to an existing tag

bganoush
bganoush asked
on
Medium Priority
2,130 Views
Last Modified: 2012-05-11
Hi,

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?
Comment
Watch Question

IT Expert
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:

Thanks I'll try that.

Author

Commented:
Thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.