| Author |
Changing default attribute values
|
Eelke Klein
Greenhorn
Joined: May 08, 2010
Posts: 2
|
|
Is there a simple way to change the default value of an attribute for the whole project? To be specific I do not want to have to specify the errorClass, fatalClass, infoClass and warClass attributes of the h:message[s] tag every time I use one. It add's a lot of code and repetition which is not good.
I guess I good make a composite component for it but I would prefer it if there is a simpler method.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
Welcome to the JavaRanch!
I'm afraid that there's no way to override the JSF default attribute values. You could define a composite control, although for consistency's sake I normally place the h:messages element in a fixed zone on the page layout (using Facelets). Meaning that I don't have multiple definitions of the messages tag, since the same copy is used for all invocations of the page template.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Eelke Klein
Greenhorn
Joined: May 08, 2010
Posts: 2
|
|
|
Thanks for the suggestion. Putting the h:messages element in the layout will be good enough in most cases.
|
 |
suresh dasari
Ranch Hand
Joined: Oct 05, 2009
Posts: 120
|
|
Hi Tim,
I have some requirement related to component attributes.
for inputtext component, while rendering is there any way to change only class and title attribute as I want to append the class attribute with errorClass style that makes the inputtext border red in color when there are any error messages and I want to paste the error message into title attribute of that control.
for time being I written a component which is exactly similar to inputtext, but cant I only override the inputtext renderer and accomplish this?
I tried to override the inputext renderer which is rendering as expected but value entered by the user is not set to backing bean where as in a custom component I am using the same logic in its renderer it is working.
your help is appreciated.
|
Sun Certified Java Programmer with 93 percent
|
 |
 |
|
|
subject: Changing default attribute values
|
|
|