File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Tags for displaying Date Input field in STRUTS? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Tags for displaying Date Input field in STRUTS?" Watch "Tags for displaying Date Input field in STRUTS?" New topic

Tags for displaying Date Input field in STRUTS?

Pras Tiwari
Ranch Hand

Joined: Nov 07, 2005
Posts: 186
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.

********Deserve Before You Desire********
Vani Bandargal
Ranch Hand

Joined: Oct 06, 2005
Posts: 82
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

Joined: Mar 20, 2005
Posts: 146
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?
I agree. Here's the link:
subject: Tags for displaying Date Input field in STRUTS?
It's not a secret anymore!