12.07.2015 Views

4.3.1.Action의 역할 - Anyframe

4.3.1.Action의 역할 - Anyframe

4.3.1.Action의 역할 - Anyframe

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Internationalization6.2.Internationalization Sample다음은 사용자의 Locale정보에 의해 JSP페이지에 Message가 다른 언어로 보여지는 예이다.6.2.1.Sample• JSPJSP화면에서 해당 언어를 클릭하면 MessageResource Bundle에 등록되어 있는msg.internationalization키에 대한 값이 "Internationalization"과 "국제화"로 바뀌는 것을 보여주는internationalization.jsp 이다.Internationalization SampleChange Language | 언어 변경 English | 영어Korean | 한국어• Action아래는 위의 JSP화면에서 해당 언어를 클릭했을 때 Action에서 Session에 사용자 Locale정보를 설정하는 예를 보여주는 InternationalizationAction.java 의 일부이다.public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws Exception {HttpSession session = request.getSession();Locale locale = getLocale(request);String language = null;String country = null;try {language = (String)PropertyUtils.getSimpleProperty(form, "language");country = (String)PropertyUtils.getSimpleProperty(form, "country");} catch (Exception e) {e.printStackTrace();}if ((language != null && language.length() > 0) &&(country != null && country.length() > 0)) {locale = new java.util.Locale(language, country);36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!