• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Tags for displaying Date Input field in STRUTS?

 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to display Date input field in my struts1.1 web Application's view page. Currently I am displaying 3 input drop-downboxes for Date, Month & Year. But I think this is not good idea as it requires each time I have to validate date into my action class or through javascript . But to avoid this is there any readymade tag available in struts for diplaying date input on JSP page ?
Please help me I am struggling with this from so long.
Thank you in advance.
Pras
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. All parameters are to be passed to and fro as Strings only.
There are some reasons why we need to follow this, though we can define
properties to be different type(boolean,Date) in your ActionForm.

2. We can use <fmt:formatDate tag so that data field can be displayed in any format(dd/mm/yy OR mm/dd/YYY ...)
 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this:

in your actionform use fields like:

In your business object Javabeans have the following:



In jou JSP refer to myDateDisplay in a text field. You can then use BeanUtils to copy the properties between the ActionForm and the Business object and your Bean will take care of the conversions.

Does that help?
 
knowledge is the difference between drudgery and strategic action -- tiny ad
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic