This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes form-property  :  newbie question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "form-property  :  newbie question" Watch "form-property  :  newbie question" New topic

form-property : newbie question


Joined: Sep 27, 2002
Posts: 9

Newbie: This is my first time using struts.

I have created an application and I would like one of my forms to allow for the submission of various dates. I have decided to use java.util.Calendar for all of my dates in this application.
How should/can I do this using struts?
What is the proper way to setup the struts-config.xml file for this to work?

Here is some code I have:

<form-bean name="SearchByDateForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="actualAwardBeginDate" type="java.util.Calendar">
<form-property name="actualAwardEndDate" type="java.util.Calendar">

If I change the property from java.util.Calendar to type=java.lang.String, how and where in the app do I need to change this to a Calendar object?

[ September 22, 2004: Message edited by: Joe Blow ]

Scott<br />Never under estimate the wisdom of nature!
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

In the Action, probably after you've validated that it is a valid date.

A good workman is known by his tools.

Joined: Sep 27, 2002
Posts: 9
So does this mean I should change the property type in the form bean to java.lang.String or leave it as Calendar?
[ September 22, 2004: Message edited by: Joe Blow ]

Joined: Sep 27, 2002
Posts: 9
Disregard my last reply. I figured out what you meant. Your advice was very helpful. Thanks.
I agree. Here's the link:
subject: form-property : newbie question
It's not a secret anymore!