Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Struts2 i18n feature in Quartz jobs

Our web application is based on Struts2. We get all message resource by using struts getText() in actions and Struts2 <s:text name=""/> in JSP.

The application also has some Quartz job which run at certain times. Is it possible that we use Struts2 classes in Quartz jobs to get the proper message resources from message bundles.

Please consider that we configured lots of message files with Struts and also, we use Struts2 ability to override certain message resources (Struts 2 override resource messages keys) so we prefer to use Struts2 way to get i18n messages instead of java build in feature.

like image 697
Alireza Fattahi Avatar asked Dec 02 '25 09:12

Alireza Fattahi


1 Answers

You can use one of the methods in LocalizedTextUtil class to get localized messages from resource bundles in Quartz jobs.

For example take a look at:

LocalizedTextUtil#findDefaultText(String aTextName, Locale locale)

or

LocalizedTextUtil#findText(Class aClass, String aTextName, Locale locale)
like image 69
Aleksandr M Avatar answered Dec 03 '25 22:12

Aleksandr M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!