Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-11 Thread Łukasz Lenart
Probably, please register an issue and assign the test app.


Regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/

2012/6/11 J. Garcia jogaco...@gmail.com:
 A full example based on struts2 blank archetype attached.
 Run with maven2: mvn jetty:run
 Url: http://localhost:8080/struts-test/example/Login

 Enter as year of birth a bad integer: 1980aaa
 You'll see the timestamp still there, BUT the milliseconds are set to zero.
 Is this a bug?

 J.

 On Fri, Jun 8, 2012 at 8:47 PM, s srrem...@excite.com wrote:

 Tried with Struts 2.3.4 and still having the issue.

 Look at View Source in the browsee and note down value of field
 student.createdTimestmp. It will have both date  time.

 Remove Name (make it blank) and click on Save button.

 Error will be displayed Student Name is required. Now again take a look
 at View Source.
 Field student.createdTimestmp will only have date and time will be
 MISSING.



 -Original Message-
 From: J. Garcia [jogaco...@gmail.com]
 Date: 06/08/2012 05:15 AM
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
 failed

 With 2.3.3, it is working for me, in my own app.
 When input is returned, I can still see the timestamp value in the form.
 Haven't tried with your example.


 On Thu, Jun 7, 2012 at 7:39 PM, s srrem...@excite.com wrote:

  Yep..That's what I did
 
  But the question is, why it retains time information, if there is no
  validation error...?
 
 
 
  -Original Message-
  From: J. Garcia [jogaco...@gmail.com]
  Date: 06/07/2012 12:21 PM
  To: Struts Users Mailing List user@struts.apache.org
  Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
  failed
 
  Try using date formatting like this:
 
  s:textfield key=student.date value='%{getText({0,date,dd/MM/
  HH:mm:ss.SSS},{student.date})}'/
 
  J.
 
  On Wed, Jun 6, 2012 at 11:08 PM, s srrem...@excite.com wrote:
 
   Here's an JSPs, action class and struts.xml
  
   http://localhost:8080/Sample/student_edit.action       calls form/jsp
   studentDetails.
  
   Erase name and submit form, this will result in validation being
   failed.
  
   This will erase timestamp from hidden field
   s:hidden name=student.createdTimestmp/
  
   If not validation error occurs, then it retains time.
  
  
  
   -Original Message-
   From: Dave Newton [davelnew...@gmail.com]
   Date: 06/06/2012 12:57 PM
   To: Struts Users Mailing List user@struts.apache.org
   Subject: Re: Struts 2 losing timestamp in java.util.Date when
   validation
   failed
  
   On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:
  
I found following work around.
Sorry can't attach source JSP, because of client restrictions.
  
  
   Here's the trivial workaround:
  
   * Create a minimally-failing example containing essentially identical
  JSP.
   * Post it.
  
   Whether or not your client wishes to admit it, it's unlikely any sort
   of
  IP
   law would protect the usage of a hidden field and date render in an
  example
   JSP.
  
   Dave
  
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 

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




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

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



Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-11 Thread J. Garcia
Done:
https://issues.apache.org/jira/browse/WW-3833


On Mon, Jun 11, 2012 at 9:32 AM, Łukasz Lenart lukasz.len...@googlemail.com
 wrote:

 Probably, please register an issue and assign the test app.


 Regards
 --
 Łukasz
 mobile +48 606 323 122 http://www.lenart.org.pl/
 Warszawa JUG conference - Confitura http://confitura.pl/

 2012/6/11 J. Garcia jogaco...@gmail.com:
  A full example based on struts2 blank archetype attached.
  Run with maven2: mvn jetty:run
  Url: http://localhost:8080/struts-test/example/Login
 
  Enter as year of birth a bad integer: 1980aaa
  You'll see the timestamp still there, BUT the milliseconds are set to
 zero.
  Is this a bug?
 
  J.
 
  On Fri, Jun 8, 2012 at 8:47 PM, s srrem...@excite.com wrote:
 
  Tried with Struts 2.3.4 and still having the issue.
 
  Look at View Source in the browsee and note down value of field
  student.createdTimestmp. It will have both date  time.
 
  Remove Name (make it blank) and click on Save button.
 
  Error will be displayed Student Name is required. Now again take a
 look
  at View Source.
  Field student.createdTimestmp will only have date and time will be
  MISSING.
 
 
 
  -Original Message-
  From: J. Garcia [jogaco...@gmail.com]
  Date: 06/08/2012 05:15 AM
  To: Struts Users Mailing List user@struts.apache.org
  Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
  failed
 
  With 2.3.3, it is working for me, in my own app.
  When input is returned, I can still see the timestamp value in the form.
  Haven't tried with your example.
 
 
  On Thu, Jun 7, 2012 at 7:39 PM, s srrem...@excite.com wrote:
 
   Yep..That's what I did
  
   But the question is, why it retains time information, if there is no
   validation error...?
  
  
  
   -Original Message-
   From: J. Garcia [jogaco...@gmail.com]
   Date: 06/07/2012 12:21 PM
   To: Struts Users Mailing List user@struts.apache.org
   Subject: Re: Struts 2 losing timestamp in java.util.Date when
 validation
   failed
  
   Try using date formatting like this:
  
   s:textfield key=student.date value='%{getText({0,date,dd/MM/
   HH:mm:ss.SSS},{student.date})}'/
  
   J.
  
   On Wed, Jun 6, 2012 at 11:08 PM, s srrem...@excite.com wrote:
  
Here's an JSPs, action class and struts.xml
   
http://localhost:8080/Sample/student_edit.action   calls
 form/jsp
studentDetails.
   
Erase name and submit form, this will result in validation being
failed.
   
This will erase timestamp from hidden field
s:hidden name=student.createdTimestmp/
   
If not validation error occurs, then it retains time.
   
   
   
-Original Message-
From: Dave Newton [davelnew...@gmail.com]
Date: 06/06/2012 12:57 PM
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: Struts 2 losing timestamp in java.util.Date when
validation
failed
   
On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:
   
 I found following work around.
 Sorry can't attach source JSP, because of client restrictions.
   
   
Here's the trivial workaround:
   
* Create a minimally-failing example containing essentially
 identical
   JSP.
* Post it.
   
Whether or not your client wishes to admit it, it's unlikely any
 sort
of
   IP
law would protect the usage of a hidden field and date render in an
   example
JSP.
   
Dave
   
   
   
 -
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
   
  
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org

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




Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-11 Thread J. Garcia
Sorry, my mistake.

Done: https://issues.apache.org/jira/browse/WW-3841


On Mon, Jun 11, 2012 at 9:41 AM, J. Garcia jogaco...@gmail.com wrote:

 Done:
 https://issues.apache.org/jira/browse/WW-3833



 On Mon, Jun 11, 2012 at 9:32 AM, Łukasz Lenart 
 lukasz.len...@googlemail.com wrote:

 Probably, please register an issue and assign the test app.


 Regards
 --
 Łukasz
 mobile +48 606 323 122 http://www.lenart.org.pl/
 Warszawa JUG conference - Confitura http://confitura.pl/

 2012/6/11 J. Garcia jogaco...@gmail.com:
  A full example based on struts2 blank archetype attached.
  Run with maven2: mvn jetty:run
  Url: http://localhost:8080/struts-test/example/Login
 
  Enter as year of birth a bad integer: 1980aaa
  You'll see the timestamp still there, BUT the milliseconds are set to
 zero.
  Is this a bug?
 
  J.
 
  On Fri, Jun 8, 2012 at 8:47 PM, s srrem...@excite.com wrote:
 
  Tried with Struts 2.3.4 and still having the issue.
 
  Look at View Source in the browsee and note down value of field
  student.createdTimestmp. It will have both date  time.
 
  Remove Name (make it blank) and click on Save button.
 
  Error will be displayed Student Name is required. Now again take a
 look
  at View Source.
  Field student.createdTimestmp will only have date and time will be
  MISSING.
 
 
 
  -Original Message-
  From: J. Garcia [jogaco...@gmail.com]
  Date: 06/08/2012 05:15 AM
  To: Struts Users Mailing List user@struts.apache.org
  Subject: Re: Struts 2 losing timestamp in java.util.Date when
 validation
  failed
 
  With 2.3.3, it is working for me, in my own app.
  When input is returned, I can still see the timestamp value in the
 form.
  Haven't tried with your example.
 
 
  On Thu, Jun 7, 2012 at 7:39 PM, s srrem...@excite.com wrote:
 
   Yep..That's what I did
  
   But the question is, why it retains time information, if there is no
   validation error...?
  
  
  
   -Original Message-
   From: J. Garcia [jogaco...@gmail.com]
   Date: 06/07/2012 12:21 PM
   To: Struts Users Mailing List user@struts.apache.org
   Subject: Re: Struts 2 losing timestamp in java.util.Date when
 validation
   failed
  
   Try using date formatting like this:
  
   s:textfield key=student.date value='%{getText({0,date,dd/MM/
   HH:mm:ss.SSS},{student.date})}'/
  
   J.
  
   On Wed, Jun 6, 2012 at 11:08 PM, s srrem...@excite.com wrote:
  
Here's an JSPs, action class and struts.xml
   
http://localhost:8080/Sample/student_edit.action   calls
 form/jsp
studentDetails.
   
Erase name and submit form, this will result in validation being
failed.
   
This will erase timestamp from hidden field
s:hidden name=student.createdTimestmp/
   
If not validation error occurs, then it retains time.
   
   
   
-Original Message-
From: Dave Newton [davelnew...@gmail.com]
Date: 06/06/2012 12:57 PM
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: Struts 2 losing timestamp in java.util.Date when
validation
failed
   
On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:
   
 I found following work around.
 Sorry can't attach source JSP, because of client restrictions.
   
   
Here's the trivial workaround:
   
* Create a minimally-failing example containing essentially
 identical
   JSP.
* Post it.
   
Whether or not your client wishes to admit it, it's unlikely any
 sort
of
   IP
law would protect the usage of a hidden field and date render in an
   example
JSP.
   
Dave
   
   
   
 -
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
   
  
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org

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





Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-11 Thread Łukasz Lenart
Yeah... I was wondering what are you doing ;-)

2012/6/11 J. Garcia jogaco...@gmail.com:
 Sorry, my mistake.

 Done: https://issues.apache.org/jira/browse/WW-3841


 On Mon, Jun 11, 2012 at 9:41 AM, J. Garcia jogaco...@gmail.com wrote:

 Done:
 https://issues.apache.org/jira/browse/WW-3833



 On Mon, Jun 11, 2012 at 9:32 AM, Łukasz Lenart
 lukasz.len...@googlemail.com wrote:

 Probably, please register an issue and assign the test app.


 Regards
 --
 Łukasz
 mobile +48 606 323 122 http://www.lenart.org.pl/
 Warszawa JUG conference - Confitura http://confitura.pl/

 2012/6/11 J. Garcia jogaco...@gmail.com:
  A full example based on struts2 blank archetype attached.
  Run with maven2: mvn jetty:run
  Url: http://localhost:8080/struts-test/example/Login
 
  Enter as year of birth a bad integer: 1980aaa
  You'll see the timestamp still there, BUT the milliseconds are set to
  zero.
  Is this a bug?
 
  J.
 
  On Fri, Jun 8, 2012 at 8:47 PM, s srrem...@excite.com wrote:
 
  Tried with Struts 2.3.4 and still having the issue.
 
  Look at View Source in the browsee and note down value of field
  student.createdTimestmp. It will have both date  time.
 
  Remove Name (make it blank) and click on Save button.
 
  Error will be displayed Student Name is required. Now again take a
  look
  at View Source.
  Field student.createdTimestmp will only have date and time will be
  MISSING.
 
 
 
  -Original Message-
  From: J. Garcia [jogaco...@gmail.com]
  Date: 06/08/2012 05:15 AM
  To: Struts Users Mailing List user@struts.apache.org
  Subject: Re: Struts 2 losing timestamp in java.util.Date when
  validation
  failed
 
  With 2.3.3, it is working for me, in my own app.
  When input is returned, I can still see the timestamp value in the
  form.
  Haven't tried with your example.
 
 
  On Thu, Jun 7, 2012 at 7:39 PM, s srrem...@excite.com wrote:
 
   Yep..That's what I did
  
   But the question is, why it retains time information, if there is no
   validation error...?
  
  
  
   -Original Message-
   From: J. Garcia [jogaco...@gmail.com]
   Date: 06/07/2012 12:21 PM
   To: Struts Users Mailing List user@struts.apache.org
   Subject: Re: Struts 2 losing timestamp in java.util.Date when
   validation
   failed
  
   Try using date formatting like this:
  
   s:textfield key=student.date value='%{getText({0,date,dd/MM/
   HH:mm:ss.SSS},{student.date})}'/
  
   J.
  
   On Wed, Jun 6, 2012 at 11:08 PM, s srrem...@excite.com wrote:
  
Here's an JSPs, action class and struts.xml
   
http://localhost:8080/Sample/student_edit.action       calls
form/jsp
studentDetails.
   
Erase name and submit form, this will result in validation being
failed.
   
This will erase timestamp from hidden field
s:hidden name=student.createdTimestmp/
   
If not validation error occurs, then it retains time.
   
   
   
-Original Message-
From: Dave Newton [davelnew...@gmail.com]
Date: 06/06/2012 12:57 PM
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: Struts 2 losing timestamp in java.util.Date when
validation
failed
   
On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:
   
 I found following work around.
 Sorry can't attach source JSP, because of client restrictions.
   
   
Here's the trivial workaround:
   
* Create a minimally-failing example containing essentially
identical
   JSP.
* Post it.
   
Whether or not your client wishes to admit it, it's unlikely any
sort
of
   IP
law would protect the usage of a hidden field and date render in
an
   example
JSP.
   
Dave
   
   
   
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org
   
  
  
  
   -
   To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
   For additional commands, e-mail: user-h...@struts.apache.org
  
  
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org

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




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



Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-08 Thread J. Garcia
With 2.3.3, it is working for me, in my own app.
When input is returned, I can still see the timestamp value in the form.
Haven't tried with your example.


On Thu, Jun 7, 2012 at 7:39 PM, s srrem...@excite.com wrote:

 Yep..That's what I did

 But the question is, why it retains time information, if there is no
 validation error...?



 -Original Message-
 From: J. Garcia [jogaco...@gmail.com]
 Date: 06/07/2012 12:21 PM
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
 failed

 Try using date formatting like this:

 s:textfield key=student.date value='%{getText({0,date,dd/MM/
 HH:mm:ss.SSS},{student.date})}'/

 J.

 On Wed, Jun 6, 2012 at 11:08 PM, s srrem...@excite.com wrote:

  Here's an JSPs, action class and struts.xml
 
  http://localhost:8080/Sample/student_edit.action   calls form/jsp
  studentDetails.
 
  Erase name and submit form, this will result in validation being failed.
 
  This will erase timestamp from hidden field
  s:hidden name=student.createdTimestmp/
 
  If not validation error occurs, then it retains time.
 
 
 
  -Original Message-
  From: Dave Newton [davelnew...@gmail.com]
  Date: 06/06/2012 12:57 PM
  To: Struts Users Mailing List user@struts.apache.org
  Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
  failed
 
  On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:
 
   I found following work around.
   Sorry can't attach source JSP, because of client restrictions.
 
 
  Here's the trivial workaround:
 
  * Create a minimally-failing example containing essentially identical
 JSP.
  * Post it.
 
  Whether or not your client wishes to admit it, it's unlikely any sort of
 IP
  law would protect the usage of a hidden field and date render in an
 example
  JSP.
 
  Dave
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 


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




Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-08 Thread s
Tried with Struts 2.3.4 and still having the issue.

Look at View Source in the browsee and note down value of field 
student.createdTimestmp. It will have both date  time.

Remove Name (make it blank) and click on Save button.

Error will be displayed Student Name is required. Now again take a look at 
View Source. 
Field student.createdTimestmp will only have date and time will be MISSING.



-Original Message-
From: J. Garcia [jogaco...@gmail.com]
Date: 06/08/2012 05:15 AM
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: Struts 2 losing timestamp in java.util.Date when validation failed

With 2.3.3, it is working for me, in my own app.
When input is returned, I can still see the timestamp value in the form.
Haven't tried with your example.


On Thu, Jun 7, 2012 at 7:39 PM, s srrem...@excite.com wrote:

 Yep..That's what I did

 But the question is, why it retains time information, if there is no
 validation error...?



 -Original Message-
 From: J. Garcia [jogaco...@gmail.com]
 Date: 06/07/2012 12:21 PM
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
 failed

 Try using date formatting like this:

 s:textfield key=student.date value='%{getText({0,date,dd/MM/
 HH:mm:ss.SSS},{student.date})}'/

 J.

 On Wed, Jun 6, 2012 at 11:08 PM, s srrem...@excite.com wrote:

  Here's an JSPs, action class and struts.xml
 
  http://localhost:8080/Sample/student_edit.action   calls form/jsp
  studentDetails.
 
  Erase name and submit form, this will result in validation being failed.
 
  This will erase timestamp from hidden field
  s:hidden name=student.createdTimestmp/
 
  If not validation error occurs, then it retains time.
 
 
 
  -Original Message-
  From: Dave Newton [davelnew...@gmail.com]
  Date: 06/06/2012 12:57 PM
  To: Struts Users Mailing List user@struts.apache.org
  Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
  failed
 
  On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:
 
   I found following work around.
   Sorry can't attach source JSP, because of client restrictions.
 
 
  Here's the trivial workaround:
 
  * Create a minimally-failing example containing essentially identical
 JSP.
  * Post it.
 
  Whether or not your client wishes to admit it, it's unlikely any sort of
 IP
  law would protect the usage of a hidden field and date render in an
 example
  JSP.
 
  Dave
 
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 


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



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



Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-07 Thread J. Garcia
Try using date formatting like this:

s:textfield key=student.date value='%{getText({0,date,dd/MM/
HH:mm:ss.SSS},{student.date})}'/

J.

On Wed, Jun 6, 2012 at 11:08 PM, s srrem...@excite.com wrote:

 Here's an JSPs, action class and struts.xml

 http://localhost:8080/Sample/student_edit.action   calls form/jsp
 studentDetails.

 Erase name and submit form, this will result in validation being failed.

 This will erase timestamp from hidden field
 s:hidden name=student.createdTimestmp/

 If not validation error occurs, then it retains time.



 -Original Message-
 From: Dave Newton [davelnew...@gmail.com]
 Date: 06/06/2012 12:57 PM
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
 failed

 On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:

  I found following work around.
  Sorry can't attach source JSP, because of client restrictions.


 Here's the trivial workaround:

 * Create a minimally-failing example containing essentially identical JSP.
 * Post it.

 Whether or not your client wishes to admit it, it's unlikely any sort of IP
 law would protect the usage of a hidden field and date render in an example
 JSP.

 Dave


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



Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-07 Thread s
Yep..That's what I did

But the question is, why it retains time information, if there is no validation 
error...?



-Original Message-
From: J. Garcia [jogaco...@gmail.com]
Date: 06/07/2012 12:21 PM
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: Struts 2 losing timestamp in java.util.Date when validation failed

Try using date formatting like this:

s:textfield key=student.date value='%{getText({0,date,dd/MM/
HH:mm:ss.SSS},{student.date})}'/

J.

On Wed, Jun 6, 2012 at 11:08 PM, s srrem...@excite.com wrote:

 Here's an JSPs, action class and struts.xml

 http://localhost:8080/Sample/student_edit.action   calls form/jsp
 studentDetails.

 Erase name and submit form, this will result in validation being failed.

 This will erase timestamp from hidden field
 s:hidden name=student.createdTimestmp/

 If not validation error occurs, then it retains time.



 -Original Message-
 From: Dave Newton [davelnew...@gmail.com]
 Date: 06/06/2012 12:57 PM
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: Struts 2 losing timestamp in java.util.Date when validation
 failed

 On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:

  I found following work around.
  Sorry can't attach source JSP, because of client restrictions.


 Here's the trivial workaround:

 * Create a minimally-failing example containing essentially identical JSP.
 * Post it.

 Whether or not your client wishes to admit it, it's unlikely any sort of IP
 law would protect the usage of a hidden field and date render in an example
 JSP.

 Dave


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



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



Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-06 Thread s

I have a form with java.util.Date (createTimestmp) and it has both date  time.
createTimestmp is an hidden field on the form. When I fetch record from 
database it has 5/17/12 12:58:33 PM.688 as value.

If I change something on the form and if validation is GOOD, then creatTimestmp 
value is retained to the original value. That is, its still 5/17/12 12:58:33 
PM.688.

But if the validation fails, and user goes to input form again, then 
createTimestmp value changes to 5/17/12. The timestamp is missing.

Looks like a bug to me in struts 2.

Why is struts 2 dropping timestamp on INPUT result...?

Can someone please help.

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



Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-06 Thread Dave Newton
And the JSP?

On Wed, Jun 6, 2012 at 12:18 PM, s srrem...@excite.com wrote:


 I have a form with java.util.Date (createTimestmp) and it has both date 
 time.
 createTimestmp is an hidden field on the form. When I fetch record from
 database it has 5/17/12 12:58:33 PM.688 as value.

 If I change something on the form and if validation is GOOD, then
 creatTimestmp value is retained to the original value. That is, its still
 5/17/12 12:58:33 PM.688.

 But if the validation fails, and user goes to input form again, then
 createTimestmp value changes to 5/17/12. The timestamp is missing.

 Looks like a bug to me in struts 2.

 Why is struts 2 dropping timestamp on INPUT result...?

 Can someone please help.

 -
 To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
 For additional commands, e-mail: dev-h...@struts.apache.org




Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-06 Thread s
I found following work around.

   s:date name=createTimestmp var=createTSFmt 
format=%{getText('timeStampFormat')}/
   s:hidden name=createTimestmp value=%{createTSFmt} /

where timeStampFormat is MM/dd/ hh:mm:ss a.SSS

With above, it retains hour, minutes and seconds, but drops milliseconds.

Any other suggestions, please let me know.

Sorry can't attach source JSP, because of client restrictions.

To recreate:
But one can create a model with java.util.Date and set is as hidden field on JSP

Populate some date/time before its presented to the user.

Submit form with fail validation.

So now when we come back to same view/page, the time components is missing in 
hidden field.

Thanks.
Sam
-Original Message-
From: Dave Newton [davelnew...@gmail.com]
Date: 06/06/2012 12:27 PM
To: Struts Developers List d...@struts.apache.org
CC: user@struts.apache.org
Subject: Re: Struts 2 losing timestamp in java.util.Date when validation failed

And the JSP?

On Wed, Jun 6, 2012 at 12:18 PM, s srrem...@excite.com wrote:


 I have a form with java.util.Date (createTimestmp) and it has both date 
 time.
 createTimestmp is an hidden field on the form. When I fetch record from
 database it has 5/17/12 12:58:33 PM.688 as value.

 If I change something on the form and if validation is GOOD, then
 creatTimestmp value is retained to the original value. That is, its still
 5/17/12 12:58:33 PM.688.

 But if the validation fails, and user goes to input form again, then
 createTimestmp value changes to 5/17/12. The timestamp is missing.

 Looks like a bug to me in struts 2.

 Why is struts 2 dropping timestamp on INPUT result...?

 Can someone please help.

 -
 To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
 For additional commands, e-mail: dev-h...@struts.apache.org



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



Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-06 Thread Dave Newton
On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:

 I found following work around.
 Sorry can't attach source JSP, because of client restrictions.


Here's the trivial workaround:

* Create a minimally-failing example containing essentially identical JSP.
* Post it.

Whether or not your client wishes to admit it, it's unlikely any sort of IP
law would protect the usage of a hidden field and date render in an example
JSP.

Dave


Re: Struts 2 losing timestamp in java.util.Date when validation failed

2012-06-06 Thread s
Here's an JSPs, action class and struts.xml

http://localhost:8080/Sample/student_edit.action   calls form/jsp 
studentDetails.

Erase name and submit form, this will result in validation being failed.

This will erase timestamp from hidden field 
s:hidden name=student.createdTimestmp/

If not validation error occurs, then it retains time.



-Original Message-
From: Dave Newton [davelnew...@gmail.com]
Date: 06/06/2012 12:57 PM
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: Struts 2 losing timestamp in java.util.Date when validation failed

On Wed, Jun 6, 2012 at 12:54 PM, s srrem...@excite.com wrote:

 I found following work around.
 Sorry can't attach source JSP, because of client restrictions.


Here's the trivial workaround:

* Create a minimally-failing example containing essentially identical JSP.
* Post it.

Whether or not your client wishes to admit it, it's unlikely any sort of IP
law would protect the usage of a hidden field and date render in an example
JSP.

Dave
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;

struts

constant name=struts.enable.DynamicMethodInvocation value=false /
constant name=struts.devMode value=true /

constant name=struts.custom.i18n.resources value=ApplicationResources /
		
package name=default namespace=/ extends=struts-default


action name=student_* method={1} class=com.mysample.actions.StudentAction
  interceptor-ref name=defaultStack /
  result name=success/jsp/studentDetails.jsp/result
  result name=input/jsp/studentDetails.jsp/result
  result name=list/jsp/studentList.jsp/result   
/action
   
/package

 
/struts
package com.mysample.actions;

import java.sql.Timestamp;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.mysample.model.Student;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

public class StudentAction extends ActionSupport implements Preparable{
	
	private static final long serialVersionUID = 1L;
	private Student student;
	
	public void prepare(){
		//
	}
	
	public void prepareEditSave(){
		//get Model from session
		student = (Student) ActionContext.getContext().getSession().get(model);
	}
	
	public String edit(){
		student = new Student();
		student.setId(Integer.valueOf(1001));
		student.setName(John Doe);
		student.setBirthDate(new Date(75,02,15));
		
		//Timestamp from DB
		Timestamp tmStmp = new Timestamp(1338320605000l);
		tmStmp.setNanos(34400);
		student.setCreatedTimestmp(tmStmp);
	
		//put Model in Session
		ActionContext.getContext().getSession().put(model, student);
		return SUCCESS;
	}
	

	public String editSave(){
		if (StringUtils.isBlank(student.getName())){
			addFieldError(name, Student Name is required);
			return INPUT;
		}
		
		//persist to Database  remove it from session
		ActionContext.getContext().getSession().remove(model);
		return list;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}
}
%@ page language=java contentType=text/html; charset=ISO-8859-1
pageEncoding=ISO-8859-1%
%@ taglib prefix=s uri=/struts-tags %
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;
html
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
titleStudent Detail/title
s:head/
/head
body
s:fielderror /
s:actionerror /
br
br

 s:form name=studentDetail id=studentDetail method=post theme=simple
   s:hidden name=student.createdTimestmp/
   table
   tr
   td
   s:label value=Id/:s:textfield name=student.id readonly=true 
size=15/
   /td
   tdnbsp;/td
   /tr
   tr
   td
   s:label value=Name/:s:textfield name=student.name size=50 /
   /td
   tdnbsp;/td
   /tr
   
   tr
   td
   s:date name=student.birthDate var=birthDateId format=MM/dd//
   s:label value=Birth Date/:s:textfield name=student.birthDate 
value=%{birthDateId} label=Birth Date size=10/
   /td
   tdnbsp;/td
   /tr

   
  
   tr
   td colspan=2
 s:submit action=student_editSave value=Save/ nbsp;nbsp;
 s:reset/
   /td
   /tr
   /table
 /s:form

/body
/html%@ page language=java contentType=text/html; charset=ISO-8859-1
pageEncoding=ISO-8859-1%
%@ taglib prefix=s uri=/struts-tags %
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;
html
head
meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1
titleStudent Detail/title
s:head/
/head
body
h1 Student created successfully !!!/h1
/body
/html
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org