File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to write customized Tag handler in Struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to write customized Tag handler in Struts 2" Watch "How to write customized Tag handler in Struts 2" New topic
Author

How to write customized Tag handler in Struts 2

xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 133
Hi, I have below requirment.

I have two message resource properties file. for Example. - ApplicationResources.properties and ApplicationResources-Extn.properties. I have some key values in both files but both are different. ApplicationResources-Extn.properties is used for customization of message. My requirment is that when ever i use for example <fmt:message key="mainMenu.title" />, First it has to look in to ApplicationResources-Extn.properties to get the values. If it not found there, then it will go and do lookup in ApplicationResources.properties file and return back the value.

Please suggest how i can do this.

Regards,
Sunil
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Why do you need two resource bundles, what will happen if you are having all the values in a single file.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 133
I have one resource file for product. Second resource file may contain same key or may not. Second one will be used for customization. If I want to customize for one customer, then i will change value in second file. If customization is not required, then it will pick from first resource file.

So in one way i am avoiding duplication of properties file and want to achieve customization also.

Do you have any idea. I need to consider localization also.

Regards,
Sunil
xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 133
I got some idea how to write such type of code. I have downloaded source code for tag lib and customized my class to get the desired result.

Regards,
Sunil
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Post your idea
 
jQuery in Action, 2nd edition
 
subject: How to write customized Tag handler in Struts 2