Forums Register Login

Changing default attribute values

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thanks for the suggestion. Putting the h:messages element in the layout will be good enough in most cases.
+Pie Number of slices to send: Send
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.

It runs on an internal combustion engine. This ad does not:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1500 times.
Similar Threads
explicit trans-attribute definition for session bean needed?
HOTEL ATTRIBUTES & CONSTRUCTOR
Session Id coming in URL for first time
XSD : default current date
JBoss' embedded tomcat not Logging
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:20:58.