struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Developer" <develo...@fdplus.com>
Subject Re: i18n LabelValueBean
Date Wed, 19 Jun 2002 16:56:09 GMT
Current Answer:

    Pass the servlet.getResources to the method populating the option
collection with the LabelValueBeans and get at the messages before even
creating the beans.

That seems to be working for me now.

In some utility class I have this:

 public static Collection
getSectionOptions(org.apache.struts.util.MessageResources msg){
        Collection list = new Vector();
        list.add(new
LabelValueBean(msg.getMessage("phonebook.section.classified"),"Class"));
        list.add(new
LabelValueBean(msg.getMessage("phonebook.section.alpha"),"Alpha"));
        list.add(new
LabelValueBean(msg.getMessage("phonebook.section.magazine"),"Mag"));
}

In my ActionForm, I have something like this:

    public java.util.Collection getSectionOptions() {
        return
com.fdplus.util.Utils.getSectionOptions(servlet.getResources());
    }

Any nicer approaches are welcomed.

Thank you.


----- Original Message -----
From: "Toni Charlot" <toni@fdplus.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Wednesday, June 19, 2002 11:37 AM
Subject: i18n LabelValueBean


Good morning,

I have a collection of LabelValueBeans where the labels are message resource
keys.  How do I retreive the labels for the option tag?

Thank you.



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message