Search in sources :

Example 1 with ActionMapping

use of com.liferay.portletmvc4spring.bind.annotation.ActionMapping in project liferay-blade-samples by liferay.

the class UserController method submitApplicant.

@ActionMapping
public void submitApplicant(@ModelAttribute("user") User user, BindingResult bindingResult, ModelMap modelMap, Locale locale, ActionResponse actionResponse, SessionStatus sessionStatus) {
    _localValidatorFactoryBean.validate(user, bindingResult);
    if (!bindingResult.hasErrors()) {
        if (_logger.isDebugEnabled()) {
            _logger.debug("firstName=" + user.getFirstName());
            _logger.debug("lastName=" + user.getLastName());
        }
        MutableRenderParameters mutableRenderParameters = actionResponse.getRenderParameters();
        mutableRenderParameters.setValue("javax.portlet.action", "success");
        sessionStatus.setComplete();
    } else {
        bindingResult.addError(new ObjectError("user", _messageSource.getMessage("please-correct-the-following-errors", null, locale)));
    }
}
Also used : ObjectError(org.springframework.validation.ObjectError) MutableRenderParameters(javax.portlet.MutableRenderParameters) ActionMapping(com.liferay.portletmvc4spring.bind.annotation.ActionMapping)

Aggregations

ActionMapping (com.liferay.portletmvc4spring.bind.annotation.ActionMapping)1 MutableRenderParameters (javax.portlet.MutableRenderParameters)1 ObjectError (org.springframework.validation.ObjectError)1