0

Trying to use messageSource of spring in zul files

asked 2008-11-05 12:18:21 +0800

baradhell gravatar image baradhell
30 1

I use this spring bean in my jsf pages to do the traductions.

 <bean id="msgs" name="messageSource"
        class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="defaultEncoding" value="UTF-8"/>
        <property name="fileEncodings" value="UTF-8"/>
        <property name="basenames">
            <ref bean="myMessageFiles" />
        </property>
    </bean>

In the jsp i use
<h:outputText value="#{msgs.telefono}" /> 
and i get the key "telefono" of my properties files.

I try to do something similar in a zul file but i cann't, the code...

<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
....
....

<toolbarbutton  id="startButton" image="/img/inicioicon.gif" onClick="...."   tooltiptext="${msgs.inicio}"/>

It doesn work, unable to find the propertie inicio.

it is possible to do something similar in zul files?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2008-11-06 00:45:06 +0800

henrichen gravatar image henrichen
3869 2
ZK Team

The way you did it is correct. The variable resolver have found the msgs bean. However, EL is somehow limited. It needs a getter (getInicio()) to fetch the inicio attribute. This is the limitation of the EL.

link publish delete flag offensive edit

answered 2008-11-06 11:23:41 +0800

baradhell gravatar image baradhell
30 1

Thank for four response Henri, it helped me

Finally it works with this code


<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
....
....


<toolbarbutton  id="startButton" image="/img/inicioicon.gif"
onClick="..." tooltiptext=""/>

<zscript>
  org.springframework.context.support.ReloadableResourceBundleMessageSource message =
  (org.springframework.context.support.ReloadableResourceBundleMessageSource)msgs;
   startButton.setTooltiptext(message.getMessage("inicio",null,Locale.getDefault()));
</zscript>

Thanks

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-11-05 12:18:21 +0800

Seen: 312 times

Last updated: Nov 06 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More