String to Date
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi,
Lets say I have a form bean with an attribute as a String and tomorrow if they decide that the attribute should be changed to date , if I change the attribute to Date, does struts handle automatic conversion on the UI ? else should I do this conversion in the Action class tooo???
Lets say I have a form bean with an attribute as a String and tomorrow if they decide that the attribute should be changed to date , if I change the attribute to Date, does struts handle automatic conversion on the UI ? else should I do this conversion in the Action class tooo???
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
well, if you change the form variable to be a DATE, i dont see any reason for you doing the conversion. When you access the variable from the form, it will be a date ( guessing a valid date was entered, but i do wonder about the outcome of the conversion if an invalid entry was made).
I do not see any necessity of doing a conversion, as long as a valid date gets entered
BTW, do you get the conversion working fine ( string to date ) ??
I do not see any necessity of doing a conversion, as long as a valid date gets entered
BTW, do you get the conversion working fine ( string to date ) ??
Mary Cole
Ranch Hand
Posts: 362
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Well, Thx for the reply.....it need not be a String to Date ...it can be String to int too....am asking for a clarification...what I understand is..
When a form is submitted...all the values go as String..(request.getParameter()
).I want to know if Struts converts the form parameters according to the Data type required in the formBean...if thats the case, Can change the datatype for the formBean without affecting the UI display as well as making no changes for the data type conversion in my utils or Action classes???
When a form is submitted...all the values go as String..(request.getParameter()
).I want to know if Struts converts the form parameters according to the Data type required in the formBean...if thats the case, Can change the datatype for the formBean without affecting the UI display as well as making no changes for the data type conversion in my utils or Action classes??? Vicky Mohan
Ranch Hand
Posts: 130
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
String to int --> it definitely will work ( as long as the value is a numeric). I have used it in lots of occasions. I just try to use that in occasions when i think there is no scope for conversion error. But if there is no value, it will be defaulted to 0 ( for int conversion).
Now to answer your question, Struts does attempt to do an automatic conversion and formbean will be automatically loaded with appropriate datatype. So, you dont have to do any conversions. Besides,I dont see any changes in UI as all values are String over there ..
Hope this helps.
Now to answer your question, Struts does attempt to do an automatic conversion and formbean will be automatically loaded with appropriate datatype. So, you dont have to do any conversions. Besides,I dont see any changes in UI as all values are String over there ..
Hope this helps.
Mary Cole
Ranch Hand
Posts: 362
posted 20 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thx Vijay...it helped me a lot
| rubbery bacon. rubbery tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |









