java - The method in the type is not applicable for the arguments (Date) -


i getting following error:

the method setdob(date) in type employee not applicable arguments (date) 

the class employee defined follows:

public class employee {  @column(name="dob",nullable=false,unique=false) private date dob;  public date getdob() {   return dob; } public void setdob(date date) {   this.dob = date; }  } 

the error raised in controller code below:

@controller public class employeecontroller {   @requestmapping(value = "employees/save-employee.htm")  public string saveemployee(httpservletrequest request,locale locale, model model){   employee employee = new employee();   employee.setdob(date.parsedate(request.getparameter("dob"))); //error raised here...  }  } 

i not sure why getting error, parameter of type date , passing date it.

can please me , tell me doing wrong here?

thanks time

============================= fixing problem:

thanks help, able solve problem applying following code controller class:

string dobdate = request.getparameter("dob");        simpledateformat parsedate = new simpledateformat("mm/dd/yyyy"); date dobfdate; try {   dobfdate = (date)parsedate.parse(dobdate);   employee.setdob(dobfdate);     } catch (parseexception e) {   e.printstacktrace(); } 

i have used 2 imports:

import java.util.date; import java.text.simpledateformat; 


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -