You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Diego Yasuhiko Kurisaki <di...@gmail.com> on 2007/06/14 01:11:19 UTC
[S2] Problem with Date pattern
I'm manually using the DojoTookit Date Picker withe the following pattern
dd/MM/yyy
in my action i have a setter method like this.
setDate(Date date){
this.date = date
}
But it seens that the struts 2 when sets the method changes from dd/MM/yyyy
for MM/dd/yyyy does anyone know any solution?
I've tried to make a set method that receives String and then parse the date
by myself. But the new setMethod was not called when the form is submitted
.
On 6/13/07, Torsten Römer <to...@luniks.net> wrote:
>
> Everytime my app starts, I see this in the log:
>
> 13.06.2007 23:50:27 org.apache.struts2.config.Settings getLocale
> WARNUNG: Settings: Could not parse struts.locale setting, substituting
> default VM locale
>
> I put
>
> <constant name="struts.locale" value="en_GB" />
>
> in my struts.xml, but I still get the error (and the default VM locale
> is used, which I don't want)
>
> Torsten
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
[]'s Diego Yasuhiko Kurisaki
Re: [S2] Problem with Date pattern
Posted by Diego Yasuhiko Kurisaki <di...@gmail.com>.
Yes thats right...
When i have the following signature for the setter method
setDataInicial(java.util.Date data){
}
The method is called properly and my date is setted, but it changes dd/MM
for MM/dd, so if my date is 01/12 (first of december) in my bean it turns to
12/01 (twelveth of january).
If i change my method to
setDataInicial(String data) {}
The method is not called, that doesn't make any sense to me.
On 6/14/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> Make sure the inputName matches the name of the setter method, I assume
> you
> have a getAnuncio() in your action whose result has a setDataInicial()
> method right?
>
> musachy
>
> On 6/13/07, Diego Yasuhiko Kurisaki <di...@gmail.com> wrote:
> >
> > I'm using saveFormat=rfc and java.util.Date as my object
> >
> > My dojo is.
> >
> > <div dojoType="dropdowndatepicker" id="Anuncio_anuncio_dataInicial"
> name="
> > dojo.anuncio.dataInicial" inputName="anuncio.dataInicial"
> > displayFormat="dd/MM/yyyy" saveFormat="rfc" value="<s:property value="
> > anuncio.fmtDataInicial"/>">
> >
> > and my setter
> >
> > public void setDataInicial(Date dataInicial) {
> > this.dataInicial = dataInicial;
> > }
> >
> > I've tried to change my setter method to
> >
> > public void setDataInicial(Date dataInicial) {
> > SimpleDateFormat dateFormat = new
> SimpleDateFormat("dd/MM/yyyy");
> > try {
> > this.dataInicial = dateFormat.parse(dataInicial);
> > } catch (ParseException e) {
> > // TODO Auto-generated catch block
> > e.printStackTrace();
> > }
> > }
> >
> > But then my method was not even called...
> >
> >
> > On 6/13/07, Musachy Barroso <mu...@gmail.com> wrote:
> > >
> > > Try using a Date object for your field, and set saveFormat="rfc" for
> the
> > > widget.
> > >
> > > musachy
> > >
> > > On 6/13/07, Diego Yasuhiko Kurisaki <di...@gmail.com> wrote:
> > > >
> > > > I'm manually using the DojoTookit Date Picker withe the following
> > > pattern
> > > >
> > > > dd/MM/yyy
> > > >
> > > > in my action i have a setter method like this.
> > > >
> > > > setDate(Date date){
> > > > this.date = date
> > > > }
> > > >
> > > > But it seens that the struts 2 when sets the method changes from
> > > > dd/MM/yyyy
> > > > for MM/dd/yyyy does anyone know any solution?
> > > >
> > > > I've tried to make a set method that receives String and then parse
> > the
> > > > date
> > > > by myself. But the new setMethod was not called when the form is
> > > > submitted
> > > > .
> > > >
> > > >
> > > > On 6/13/07, Torsten Römer <to...@luniks.net> wrote:
> > > > >
> > > > > Everytime my app starts, I see this in the log:
> > > > >
> > > > > 13.06.2007 23:50:27 org.apache.struts2.config.Settings getLocale
> > > > > WARNUNG: Settings: Could not parse struts.locale setting,
> > substituting
> > > > > default VM locale
> > > > >
> > > > > I put
> > > > >
> > > > > <constant name="struts.locale" value="en_GB" />
> > > > >
> > > > > in my struts.xml, but I still get the error (and the default VM
> > locale
> > > > > is used, which I don't want)
> > > > >
> > > > > Torsten
> > > > >
> > > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > > For additional commands, e-mail: user-help@struts.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > []'s Diego Yasuhiko Kurisaki
> > > >
> > >
> > >
> > >
> > > --
> > > "Hey you! Would you help me to carry the stone?" Pink Floyd
> > >
> >
> >
> >
> > --
> > []'s Diego Yasuhiko Kurisaki
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
--
[]'s Diego Yasuhiko Kurisaki
Re: [S2] Problem with Date pattern
Posted by Musachy Barroso <mu...@gmail.com>.
Make sure the inputName matches the name of the setter method, I assume you
have a getAnuncio() in your action whose result has a setDataInicial()
method right?
musachy
On 6/13/07, Diego Yasuhiko Kurisaki <di...@gmail.com> wrote:
>
> I'm using saveFormat=rfc and java.util.Date as my object
>
> My dojo is.
>
> <div dojoType="dropdowndatepicker" id="Anuncio_anuncio_dataInicial" name="
> dojo.anuncio.dataInicial" inputName="anuncio.dataInicial"
> displayFormat="dd/MM/yyyy" saveFormat="rfc" value="<s:property value="
> anuncio.fmtDataInicial"/>">
>
> and my setter
>
> public void setDataInicial(Date dataInicial) {
> this.dataInicial = dataInicial;
> }
>
> I've tried to change my setter method to
>
> public void setDataInicial(Date dataInicial) {
> SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
> try {
> this.dataInicial = dateFormat.parse(dataInicial);
> } catch (ParseException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
>
> But then my method was not even called...
>
>
> On 6/13/07, Musachy Barroso <mu...@gmail.com> wrote:
> >
> > Try using a Date object for your field, and set saveFormat="rfc" for the
> > widget.
> >
> > musachy
> >
> > On 6/13/07, Diego Yasuhiko Kurisaki <di...@gmail.com> wrote:
> > >
> > > I'm manually using the DojoTookit Date Picker withe the following
> > pattern
> > >
> > > dd/MM/yyy
> > >
> > > in my action i have a setter method like this.
> > >
> > > setDate(Date date){
> > > this.date = date
> > > }
> > >
> > > But it seens that the struts 2 when sets the method changes from
> > > dd/MM/yyyy
> > > for MM/dd/yyyy does anyone know any solution?
> > >
> > > I've tried to make a set method that receives String and then parse
> the
> > > date
> > > by myself. But the new setMethod was not called when the form is
> > > submitted
> > > .
> > >
> > >
> > > On 6/13/07, Torsten Römer <to...@luniks.net> wrote:
> > > >
> > > > Everytime my app starts, I see this in the log:
> > > >
> > > > 13.06.2007 23:50:27 org.apache.struts2.config.Settings getLocale
> > > > WARNUNG: Settings: Could not parse struts.locale setting,
> substituting
> > > > default VM locale
> > > >
> > > > I put
> > > >
> > > > <constant name="struts.locale" value="en_GB" />
> > > >
> > > > in my struts.xml, but I still get the error (and the default VM
> locale
> > > > is used, which I don't want)
> > > >
> > > > Torsten
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > []'s Diego Yasuhiko Kurisaki
> > >
> >
> >
> >
> > --
> > "Hey you! Would you help me to carry the stone?" Pink Floyd
> >
>
>
>
> --
> []'s Diego Yasuhiko Kurisaki
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd
Re: [S2] Problem with Date pattern
Posted by Diego Yasuhiko Kurisaki <di...@gmail.com>.
I'm using saveFormat=rfc and java.util.Date as my object
My dojo is.
<div dojoType="dropdowndatepicker" id="Anuncio_anuncio_dataInicial" name="
dojo.anuncio.dataInicial" inputName="anuncio.dataInicial"
displayFormat="dd/MM/yyyy" saveFormat="rfc" value="<s:property value="
anuncio.fmtDataInicial"/>">
and my setter
public void setDataInicial(Date dataInicial) {
this.dataInicial = dataInicial;
}
I've tried to change my setter method to
public void setDataInicial(Date dataInicial) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
try {
this.dataInicial = dateFormat.parse(dataInicial);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
But then my method was not even called...
On 6/13/07, Musachy Barroso <mu...@gmail.com> wrote:
>
> Try using a Date object for your field, and set saveFormat="rfc" for the
> widget.
>
> musachy
>
> On 6/13/07, Diego Yasuhiko Kurisaki <di...@gmail.com> wrote:
> >
> > I'm manually using the DojoTookit Date Picker withe the following
> pattern
> >
> > dd/MM/yyy
> >
> > in my action i have a setter method like this.
> >
> > setDate(Date date){
> > this.date = date
> > }
> >
> > But it seens that the struts 2 when sets the method changes from
> > dd/MM/yyyy
> > for MM/dd/yyyy does anyone know any solution?
> >
> > I've tried to make a set method that receives String and then parse the
> > date
> > by myself. But the new setMethod was not called when the form is
> > submitted
> > .
> >
> >
> > On 6/13/07, Torsten Römer <to...@luniks.net> wrote:
> > >
> > > Everytime my app starts, I see this in the log:
> > >
> > > 13.06.2007 23:50:27 org.apache.struts2.config.Settings getLocale
> > > WARNUNG: Settings: Could not parse struts.locale setting, substituting
> > > default VM locale
> > >
> > > I put
> > >
> > > <constant name="struts.locale" value="en_GB" />
> > >
> > > in my struts.xml, but I still get the error (and the default VM locale
> > > is used, which I don't want)
> > >
> > > Torsten
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> >
> > --
> > []'s Diego Yasuhiko Kurisaki
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
--
[]'s Diego Yasuhiko Kurisaki
Re: [S2] Problem with Date pattern
Posted by Musachy Barroso <mu...@gmail.com>.
Try using a Date object for your field, and set saveFormat="rfc" for the
widget.
musachy
On 6/13/07, Diego Yasuhiko Kurisaki <di...@gmail.com> wrote:
>
> I'm manually using the DojoTookit Date Picker withe the following pattern
>
> dd/MM/yyy
>
> in my action i have a setter method like this.
>
> setDate(Date date){
> this.date = date
> }
>
> But it seens that the struts 2 when sets the method changes from
> dd/MM/yyyy
> for MM/dd/yyyy does anyone know any solution?
>
> I've tried to make a set method that receives String and then parse the
> date
> by myself. But the new setMethod was not called when the form is
> submitted
> .
>
>
> On 6/13/07, Torsten Römer <to...@luniks.net> wrote:
> >
> > Everytime my app starts, I see this in the log:
> >
> > 13.06.2007 23:50:27 org.apache.struts2.config.Settings getLocale
> > WARNUNG: Settings: Could not parse struts.locale setting, substituting
> > default VM locale
> >
> > I put
> >
> > <constant name="struts.locale" value="en_GB" />
> >
> > in my struts.xml, but I still get the error (and the default VM locale
> > is used, which I don't want)
> >
> > Torsten
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> --
> []'s Diego Yasuhiko Kurisaki
>
--
"Hey you! Would you help me to carry the stone?" Pink Floyd