aspose file tools*
The moose likes JSF and the fly likes Changing default value for JSF tag Property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Changing default value for JSF tag Property" Watch "Changing default value for JSF tag Property" New topic
Author

Changing default value for JSF tag Property

Chris Wagnor
Greenhorn

Joined: May 03, 2004
Posts: 21
Hi Gurus
I tried browsing the threads but couldnt find what I was looking for. Here is my problem:
We have a huge application which has been in development since last 4-5 years. We are using Richfaces, JSF and Seam on JBoss App Server. There are around a couple of hundred views in our application. Recently due to the change in the names of certain products we offer we had to add a "®" and "©" symbols in the product names.

Currently in all our pages we are not using escape="false" whenever rendering the product names on the pages. Due to this product name change, some of the product have "& copy;" at the end rather than the copyright symbol.

Here is my problem: To solve this we have to either go thru all the xhtml pages (a couple of hundreds in our case) and add escape="false" to each one of them. OR was just searching for options to change the default value of h: outputText's escape to "false"?
Is it possible to achieve this somehow? Maybe by faces config?

TIA Gurus
Christian Nicoll
Ranch Hand

Joined: Mar 09, 2008
Posts: 106
Hi Chris,

I don't believe that the faces-config.xml will provide a way to customize your <hutputText>. This is not my understanding how the faces-config.xml is intended.

My first thought was to create a custom component which is derived from the outputText component with the only difference that the default value for escape is setting to false. But this solution will not solve your problem because you still have to change all your pages. My second idea was to overwrite the implementation of the existing outputText component, so there would be no changes in your pages.

A third possible solution is to use a common texteditor (Notepad++, UltraEdit) and change your pages by the usage of a regular expression pattern.


SCJP 5, SCJD 5, SCWCD 5, SCBCD 5, SCJDWS 5
My SCBCD-Notes - My Hello World Webservice
Chris Wagnor
Greenhorn

Joined: May 03, 2004
Posts: 21
Thanks Christian for quick reply.

Actually I mentioned faces-config.xml because I saw a <component> tag which has <attribute> value to it. I mistakenly thought that we can override the attributes for any class. Something like:


I tried using it with no luck.

I guess I am left with no other option than to go thru each file and update it.

Thanks again
Chris
Christian Nicoll
Ranch Hand

Joined: Mar 09, 2008
Posts: 106
Hi Chris,

I'ven't known those tags in the faces-config.xml and I'm not sure if the usage of them can help you. Perhaps.

We did you use the class javax.el.ValueExpression instead of java.lang.String when you use just an ordinary String-value ("false") instead of a ValueExpression (#{myValue}) ?

Chris Wagnor
Greenhorn

Joined: May 03, 2004
Posts: 21
Got some inputs from the Javadoc for that tag:
http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/h/outputText.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Changing default value for JSF tag Property