You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by pilou <gp...@sopragroup.com> on 2007/10/08 16:18:28 UTC

ModelDriven Resource Bundle not working ?

hi
I noticed that the property bundles named with the Model Bean class name
does not seem to work.
Here is my example :
the bean class and bundle and action class are in the same package, 

Bundles name => PersonneFilterBean.properties

Java sources for the bean =>
======================

package exemple.action.admin;

public class PersonneFilterBean {

   private String nom;
   private Integer age;

   public String getNom() {
      return nom;
   }

   public void setNom(String nom) {
      this.nom = nom;
   }

   public Integer getAge() {
      return age;
   }

   public void setAge(Integer age) {
      this.age = age;
   }
}


Java source for the ACTION =>
======================

public class PersonneFilterAction extends ExempleAction implements
ModelDriven<PersonneFilterBean> {

   private static final long serialVersionUID = -2355406819601885551L;
   private PersonneFilterBean m_personneFilterBean = new
PersonneFilterBean();

   @Override
   public String execute() throws Exception {
      getLog().debug("OK success !");
      return SUCCESS;
   }

   public PersonneFilterBean getModel() {
      getLog().debug("OK success !");
      return m_personneFilterBean;
   }
}


thanks for help
-- 
View this message in context: http://www.nabble.com/ModelDriven-Resource-Bundle-not-working---tf4588469.html#a13097564
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: ModelDriven Resource Bundle not working ?

Posted by pilou <gp...@sopragroup.com>.
well, I am using it in a simple JSP :
<s:form action="filterPersonne_list" method="post" validate="false">
	<s:textfield key="personne.nom" name="nom"  />
	<s:textfield key="personne.age" name="age"  theme="xhtml" />
	<s:submit key="button.search" />
</s:form>


If I put the key/value  in PersonneFilterAction.properties
(<action>.properties  it works, but not in 
<modelbean>.properties  PersonneFilterBean.properties

gpeel@sopragroup.com




Ian Roughley wrote:
> 
> Model properties files are used for supplying field description and 
> validation messages for a model object.  I know it works ;-)  but I 
> don't know how you are using it from the code supplied.
> 
> /Ian
> 
> Dave Newton wrote:
>> Hmm, in the docs [1] it says that it will search for
>> "ModelDriven's model", although I haven't tried it
>> myself.
>>
>> d.
>>
>> [1]
>> http://struts.apache.org/2.x/docs/localization.html
>>
>> --- Zarar Siddiqi <za...@gmail.com> wrote:
>>
>>   
>>> I thought you could only specify properties files
>>> for action beans,
>>> not model ones. So in your case try specifying
>>> PersonneFilterAction.properties
>>>
>>> Zarar
>>>
>>>
>>> On 10/8/07, pilou <gp...@sopragroup.com> wrote:
>>>     
>>>> hi
>>>> I noticed that the property bundles named with the
>>>>       
>>> Model Bean class name
>>>     
>>>> does not seem to work.
>>>> Here is my example :
>>>> the bean class and bundle and action class are in
>>>>       
>>> the same package,
>>>     
>>>> Bundles name => PersonneFilterBean.properties
>>>>
>>>> Java sources for the bean =>
>>>> ======================
>>>>
>>>> package exemple.action.admin;
>>>>
>>>> public class PersonneFilterBean {
>>>>
>>>>    private String nom;
>>>>    private Integer age;
>>>>
>>>>    public String getNom() {
>>>>       return nom;
>>>>    }
>>>>
>>>>    public void setNom(String nom) {
>>>>       this.nom = nom;
>>>>    }
>>>>
>>>>    public Integer getAge() {
>>>>       return age;
>>>>    }
>>>>
>>>>    public void setAge(Integer age) {
>>>>       this.age = age;
>>>>    }
>>>> }
>>>>
>>>>
>>>> Java source for the ACTION =>
>>>> ======================
>>>>
>>>> public class PersonneFilterAction extends
>>>>       
>>> ExempleAction implements
>>>     
>>>> ModelDriven<PersonneFilterBean> {
>>>>
>>>>    private static final long serialVersionUID =
>>>>       
>>> -2355406819601885551L;
>>>     
>>>>    private PersonneFilterBean m_personneFilterBean
>>>>       
>>> = new
>>>     
>>>> PersonneFilterBean();
>>>>
>>>>    @Override
>>>>    public String execute() throws Exception {
>>>>       getLog().debug("OK success !");
>>>>       return SUCCESS;
>>>>    }
>>>>
>>>>    public PersonneFilterBean getModel() {
>>>>       getLog().debug("OK success !");
>>>>       return m_personneFilterBean;
>>>>    }
>>>> }
>>>>
>>>>
>>>> thanks for help
>>>> --
>>>> View this message in context:
>>>>       
>> http://www.nabble.com/ModelDriven-Resource-Bundle-not-working---tf4588469.html#a13097564
>>   
>>>> Sent from the Struts - User mailing list archive
>>>>       
>>> at Nabble.com.
>>>     
>>>>
>>>>       
>> ---------------------------------------------------------------------
>>   
>>>> To unsubscribe, e-mail:
>>>>       
>>> user-unsubscribe@struts.apache.org
>>>     
>>>> For additional commands, e-mail:
>>>>       
>>> user-help@struts.apache.org
>>>     
>>>>       
>>>     
>> ---------------------------------------------------------------------
>>   
>>> To unsubscribe, e-mail:
>>> user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail:
>>> user-help@struts.apache.org
>>>
>>>
>>>     
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/ModelDriven-Resource-Bundle-not-working---tf4588469.html#a13110515
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: ModelDriven Resource Bundle not working ?

Posted by Ian Roughley <ia...@fdar.com>.
Model properties files are used for supplying field description and 
validation messages for a model object.  I know it works ;-)  but I 
don't know how you are using it from the code supplied.

/Ian

Dave Newton wrote:
> Hmm, in the docs [1] it says that it will search for
> "ModelDriven's model", although I haven't tried it
> myself.
>
> d.
>
> [1]
> http://struts.apache.org/2.x/docs/localization.html
>
> --- Zarar Siddiqi <za...@gmail.com> wrote:
>
>   
>> I thought you could only specify properties files
>> for action beans,
>> not model ones. So in your case try specifying
>> PersonneFilterAction.properties
>>
>> Zarar
>>
>>
>> On 10/8/07, pilou <gp...@sopragroup.com> wrote:
>>     
>>> hi
>>> I noticed that the property bundles named with the
>>>       
>> Model Bean class name
>>     
>>> does not seem to work.
>>> Here is my example :
>>> the bean class and bundle and action class are in
>>>       
>> the same package,
>>     
>>> Bundles name => PersonneFilterBean.properties
>>>
>>> Java sources for the bean =>
>>> ======================
>>>
>>> package exemple.action.admin;
>>>
>>> public class PersonneFilterBean {
>>>
>>>    private String nom;
>>>    private Integer age;
>>>
>>>    public String getNom() {
>>>       return nom;
>>>    }
>>>
>>>    public void setNom(String nom) {
>>>       this.nom = nom;
>>>    }
>>>
>>>    public Integer getAge() {
>>>       return age;
>>>    }
>>>
>>>    public void setAge(Integer age) {
>>>       this.age = age;
>>>    }
>>> }
>>>
>>>
>>> Java source for the ACTION =>
>>> ======================
>>>
>>> public class PersonneFilterAction extends
>>>       
>> ExempleAction implements
>>     
>>> ModelDriven<PersonneFilterBean> {
>>>
>>>    private static final long serialVersionUID =
>>>       
>> -2355406819601885551L;
>>     
>>>    private PersonneFilterBean m_personneFilterBean
>>>       
>> = new
>>     
>>> PersonneFilterBean();
>>>
>>>    @Override
>>>    public String execute() throws Exception {
>>>       getLog().debug("OK success !");
>>>       return SUCCESS;
>>>    }
>>>
>>>    public PersonneFilterBean getModel() {
>>>       getLog().debug("OK success !");
>>>       return m_personneFilterBean;
>>>    }
>>> }
>>>
>>>
>>> thanks for help
>>> --
>>> View this message in context:
>>>       
> http://www.nabble.com/ModelDriven-Resource-Bundle-not-working---tf4588469.html#a13097564
>   
>>> Sent from the Struts - User mailing list archive
>>>       
>> at Nabble.com.
>>     
>>>
>>>       
> ---------------------------------------------------------------------
>   
>>> To unsubscribe, e-mail:
>>>       
>> user-unsubscribe@struts.apache.org
>>     
>>> For additional commands, e-mail:
>>>       
>> user-help@struts.apache.org
>>     
>>>       
>>     
> ---------------------------------------------------------------------
>   
>> To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   

Re: ModelDriven Resource Bundle not working ?

Posted by Dave Newton <ne...@yahoo.com>.
Hmm, in the docs [1] it says that it will search for
"ModelDriven's model", although I haven't tried it
myself.

d.

[1]
http://struts.apache.org/2.x/docs/localization.html

--- Zarar Siddiqi <za...@gmail.com> wrote:

> I thought you could only specify properties files
> for action beans,
> not model ones. So in your case try specifying
> PersonneFilterAction.properties
> 
> Zarar
> 
> 
> On 10/8/07, pilou <gp...@sopragroup.com> wrote:
> >
> > hi
> > I noticed that the property bundles named with the
> Model Bean class name
> > does not seem to work.
> > Here is my example :
> > the bean class and bundle and action class are in
> the same package,
> >
> > Bundles name => PersonneFilterBean.properties
> >
> > Java sources for the bean =>
> > ======================
> >
> > package exemple.action.admin;
> >
> > public class PersonneFilterBean {
> >
> >    private String nom;
> >    private Integer age;
> >
> >    public String getNom() {
> >       return nom;
> >    }
> >
> >    public void setNom(String nom) {
> >       this.nom = nom;
> >    }
> >
> >    public Integer getAge() {
> >       return age;
> >    }
> >
> >    public void setAge(Integer age) {
> >       this.age = age;
> >    }
> > }
> >
> >
> > Java source for the ACTION =>
> > ======================
> >
> > public class PersonneFilterAction extends
> ExempleAction implements
> > ModelDriven<PersonneFilterBean> {
> >
> >    private static final long serialVersionUID =
> -2355406819601885551L;
> >    private PersonneFilterBean m_personneFilterBean
> = new
> > PersonneFilterBean();
> >
> >    @Override
> >    public String execute() throws Exception {
> >       getLog().debug("OK success !");
> >       return SUCCESS;
> >    }
> >
> >    public PersonneFilterBean getModel() {
> >       getLog().debug("OK success !");
> >       return m_personneFilterBean;
> >    }
> > }
> >
> >
> > thanks for help
> > --
> > View this message in context:
>
http://www.nabble.com/ModelDriven-Resource-Bundle-not-working---tf4588469.html#a13097564
> > Sent from the Struts - User mailing list archive
> at Nabble.com.
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


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


Re: ModelDriven Resource Bundle not working ?

Posted by Zarar Siddiqi <za...@gmail.com>.
I thought you could only specify properties files for action beans,
not model ones. So in your case try specifying
PersonneFilterAction.properties

Zarar


On 10/8/07, pilou <gp...@sopragroup.com> wrote:
>
> hi
> I noticed that the property bundles named with the Model Bean class name
> does not seem to work.
> Here is my example :
> the bean class and bundle and action class are in the same package,
>
> Bundles name => PersonneFilterBean.properties
>
> Java sources for the bean =>
> ======================
>
> package exemple.action.admin;
>
> public class PersonneFilterBean {
>
>    private String nom;
>    private Integer age;
>
>    public String getNom() {
>       return nom;
>    }
>
>    public void setNom(String nom) {
>       this.nom = nom;
>    }
>
>    public Integer getAge() {
>       return age;
>    }
>
>    public void setAge(Integer age) {
>       this.age = age;
>    }
> }
>
>
> Java source for the ACTION =>
> ======================
>
> public class PersonneFilterAction extends ExempleAction implements
> ModelDriven<PersonneFilterBean> {
>
>    private static final long serialVersionUID = -2355406819601885551L;
>    private PersonneFilterBean m_personneFilterBean = new
> PersonneFilterBean();
>
>    @Override
>    public String execute() throws Exception {
>       getLog().debug("OK success !");
>       return SUCCESS;
>    }
>
>    public PersonneFilterBean getModel() {
>       getLog().debug("OK success !");
>       return m_personneFilterBean;
>    }
> }
>
>
> thanks for help
> --
> View this message in context: http://www.nabble.com/ModelDriven-Resource-Bundle-not-working---tf4588469.html#a13097564
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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