java - How to work with Spring based form tag Date field? -


in spring application have jsp , form.

demo.jsp have 1 field <form:input path="fromdate"/>

and in demoform have field private date fromdate;,

when store value null value storing...

my question direct tag store date in spring supplied jsp tag.

other wise give me other alternate way..

you need define custom editor date in controller. please try below code.

@initbinder public void initbinder(httpservletrequest request, servletrequestdatabinder binder) {     dateformat df = new simpledateformat("dd-mm-yyyy");     df.setlenient(false);     customdateeditor editor = new customdateeditor(df, true); // second argument 'allowempty' set true allow  null/empty values.     binder.registercustomeditor(date.class, editor); } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -