java - How to input a date with a specific date format in struts 2.2.3.1? -
i want know if there way force input format date in struts, dd/mm/yyyy .
date written in text field. read locale sensitive subject, seems switch locales simple changing of format.
know call addfielderror(fieldname, errormessage)
inside method of action class me feels date format should have been thought of configured in action-validation.xml file. searched configure properties file found no working example.
using custom strutstypeconverter
, addfielderror(fieldname, errormessage)
way it? or there version of struts in date format inputed in text field can specified?
update: assumed made myself clear enough answers demostrate otherwise.
use case is: user enters manually date in arbitrary format in textfield, afterwards struts2 validates date format corresponding format set programmer or not, displaying message accordingly.
jquery date picker <s:date>
tag can alternative want achieve, it not asked. furthermore, javascript can disabled, rendering date picker useless, jquery being javascript library far understand it.
my action implemented modeldriven
date format can't supplied anywhere forced in text field, did use own validator, changed mapping of form element string
named in action class, used validator simpledateformat
format retrieved resource bundle convert date, formated date again, see if representation same 1 inputed in text field. hardly after format clear.
if there other suggestions welcome them, seems choice.
find drawback @ least annoying.
Comments
Post a Comment