Guys, well, I have done enough research, but I can’t find a solution to this.
In short, I just pass url encoded data to the Controller method and try to convert it as a domain object that has a date and integers.
@RequestMapping(value = "/savePassport", method = RequestMethod.POST) public @ResponseBody AjaxResponse savePassport(@RequestBody StaffPassport passport, HttpServletResponse response) {
}
The personnel passport is as follows:
import java.sql.Date; public class StaffPassport { private int staffId; private String passportNumber; private String placeOfIssue; private Date issueDate; private Date expiryDate; private String spouseName; private String oldPassportRef; private String visaInfo; private String description;
When I call / savePassport, I get an unsupported media exception. I assume this is due to casting.
I cannot work correctly. Of course, I can catch individual form data using @RequestParam and manually cast, but that’s not the point of the frame, is it?
Where am I mistaken? And you are right. I'm new to Spring, but I like it.
Firdous amir
source share