Last active
December 25, 2015 06:39
-
-
Save ricston-git/6934218 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Controller | |
public class myControllerExample{ | |
@Autowired | |
MessageSource msgSource; | |
@RequestMapping(value="/", method= RequestMethod.CREATE) | |
public String create(Model uiModel, HttpServletRequest request) | |
{ | |
//I get the message from the property file | |
//using getMessage(String code, Object[] arguments, String defaultMessage, Locale locale); | |
/* * defaultMessage is only used if the property file isn't found | |
* or you don't have a default property file for the current language. | |
* You can create a default property file for each language, for that you only have | |
* to write it without the lang extension (_es or _en, etc.) * */ | |
msgSource.getMessage("myMessageCode", null, "Hello world!", request); | |
uiModel.addAttribute("viewMsg",msg); //This will add a property to the view. | |
return "view1"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment