Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tags for displaying Date Input field in STRUTS?

 
Pras Tiwari
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • 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
 
Vani Bandargal
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • 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 ...)
 
Daniel Dalton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic