-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Question 1:
In Zk, I want to use org.zkoss.zkplus.spring.DelegatingVariableResolver to bind spring bean. If the session is serialized, would the spring bean be serialized as well?
Question 2:
Zk uses i3 properties for localization. I use spring's messageSource to load up a list of property files (i.e. message_en.properties, message_fr.properties, error_en.properties, error_fr.properties......)
Is it possible to configure Zk to
1: use spring's messageSource
2: specify a list of property files for Zk to use, instead of the i3 properties.
For doing custom internalization ,
check here http://docs.zkoss.org/wiki/Internationalization#Labels,
last paragraph in this session:
"In addition, you could extend the label loader to load labels from other locations, say database, by registering a locator, which must implement the org.zkoss.util.resource.LabelLocator interface. Then, invoke the register method of the org.zkoss.util.resource.Labels class."
I looked at the LabelLoader class and LabelLocator interface. It looks like registering the locator must be done before any prior access to getLabel(String key). Otherwise, only i3 properties will be loaded.
I suppose I can do registering in some sort of initialization servlet.
Any other suggestions?
you can do it in your servlet or register some listener of ZK in zk.xml , both OK I think.
I'm also using Spring's MessageSource. I create a LocalizationManager class which I register as a been with id 'lm'. Then I use MVEL expressions instead of standard EL. This way I can do the following in my zul files:
<label value="${lm.getMessage("message.key")}" />
or:
<label value="${lm.getMessage('amount.earned.message', 5.36)}" />
if I have a parameter.
To use MVEL, add the following to the beginning of your zul page:
<?evaluator name="mvel"?>
I have not yet found a way to set it application wide in zk.xml.
did you set this in page?
<?variable-resolver class="org.zkoss.zkplus.seasar.DelegatingVariableResolver"?>
Asked: 2009-01-15 15:22:22 +0800
Seen: 382 times
Last updated: Jan 19 '09