This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSF and the fly likes Changing default attribute values Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Changing default attribute values" Watch "Changing default attribute values" New topic
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
    
    7

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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Changing default attribute values
 
Similar Threads
JBoss' embedded tomcat not Logging
HOTEL ATTRIBUTES & CONSTRUCTOR
explicit trans-attribute definition for session bean needed?
Session Id coming in URL for first time
XSD : default current date