Hi
My Controller : "AccountController" have to handle multiple POST-requests for Example SendPrivateMessage, SaveProfileSettings etc.
the method doPost getting allways as parameter 'obj' simple Object. no way to cast...Code:@Controller @RequestMapping(value = "/profile") public class AccountController{ @RequestMapping(method = RequestMethod.POST) public String doPost(Object obj, HttpServletRequest request, Model model) { _logger.info("doPost:" + obj); if(obj instanceof MessageReply){ MessageReply message = (MessageReply) obj; return doSendMessage(message, request); } else if (obj instanceof ProfileSettings){ _logger.info("ProfileSettings: " + obj); } else { _logger.info(obj.getClass().toString()); // <- allways 'java.lang.Object' } return Page.USER_HOME.file; } //.... }
How can i handle multiple POSTs in the same Controller?
Important: I dont want to use other Controllers and i have to stay in "/profile"-Path
Thx!


Reply With Quote