{"id":312,"date":"2012-02-04T12:36:50","date_gmt":"2012-02-04T03:36:50","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2012\/02\/04\/spring_mvc\/"},"modified":"2012-02-04T12:36:50","modified_gmt":"2012-02-04T03:36:50","slug":"spring_mvc","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2012\/02\/04\/spring_mvc\/","title":{"rendered":"Spring MVC \u56fd\u969b\u5316\u5bfe\u5fdc"},"content":{"rendered":"<p>\u3092\u3001\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u884c\u3046\u3002\u30fb\u30fb\u30fb\u3082\u3001\u82e5\u5e72\u624b\u3053\u305a\u3063\u305f\u306e\u3067\u624b\u9806\u3092\u30e1\u30e2\u3057\u3066\u304a\u304f\u3002<\/p>\n<ul>\n<li><a href=\"http:\/\/viralpatel.net\/blogs\/2010\/07\/spring-3-mvc-internationalization-i18n-localization-tutorial-example.html\">Spring 3 MVC: Internationalization &amp; Localization Tutorial with Example<\/a> <\/li>\n<li><a href=\"http:\/\/d.hatena.ne.jp\/GreenTea2010\/20110529\/1306692169\">SpringMVC\u3092\u306f\u3058\u3081\u308b\u2464 \uff5e \u30ed\u30b1\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3002<\/a> <\/li>\n<li><a href=\"https:\/\/jira.springsource.org\/browse\/SPR-6555\">Have mvc:annotation-driven Setup I18N<\/a> <\/li>\n<\/ul>\n<h2>\u30d7\u30ed\u30d1\u30c6\u30a3\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001WEB-INF\/i18n \u30d5\u30a9\u30eb\u30c0\u306b\u7f6e\u304f<\/h2>\n<p>message_[\u8a00\u8a9e].properties \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210<\/p>\n<ul>\n<li>messages_en.properties <\/li>\n<li>messages_ja.properties <\/li>\n<\/ul>\n<h3>\u82f1\u8a9e\u7528 WEB-INF\/i18n\/messages_en.properties<\/h3>\n<pre class=\"prettyprint linenums\">label.firstname=First Name<\/pre>\n<h3>\u65e5\u672c\u8a9e\u7528 WEB-INF\/i18n\/messages_ja.properties<\/h3>\n<p>\u65e5\u672c\u8a9e\u306a\u3069<a href=\"http:\/\/e-words.jp\/w\/ASCIIE69687E5AD97.html\">ASCII\u6587\u5b57<\/a>\u4ee5\u5916\u3092\u542b\u3080\u5834\u5408\u3001<a href=\"http:\/\/docs.oracle.com\/javase\/6\/docs\/technotes\/tools\/windows\/native2ascii.html\">native2ascii<\/a> \u3067\u30e6\u30cb\u30b3\u30fc\u30c9\u306b\u5909\u63db\u3059\u308b<\/p>\n<pre class=\"prettyprint linenums\">label.firstname=\\u540d\\u524d<\/pre>\n<h2>Spring \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210<\/h2>\n<h3>\u56fd\u969b\u5316\u5bfe\u5fdc\u7528\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210 i18n.xml<\/h3>\n<p>Spring MVC 3.05 \u3067\u78ba\u8a8d\u3057\u3066\u3044\u305f\u306e\u3060\u304c\u3001\u4e0a\u8a18\u30b5\u30a4\u30c8\u306a\u3069\u3092\u53c2\u8003\u306b\u3057\u3066\u8a66\u884c\u932f\u8aa4\u306e\u5f8c\u306b\u52d5\u304f\u3088\u3046\u306b\u306a\u3063\u305f\u8a2d\u5b9a\u3002<\/p>\n<ul>\n<li>DefaultAnnotationHandlerMapping \u3068 mvc:annotation-dricen \u306b<a href=\"http:\/\/forum.springsource.org\/showthread.php?81238-Conflict-between-lt-mvc-annotation-driven-gt-and-DefaultAnnotationHandlerMapping\">\u30b3\u30f3\u30d5\u30ea\u30af\u30c8\u306e\u554f\u984c<\/a>\u304c\u3042\u308b\u3088\u3046\u3060 <\/li>\n<li>mvc:annotation-driven \u306e\u8a18\u8ff0\u304c\u5fc5\u8981 <\/li>\n<li>locationChangeInterceptor \u306e paramName \u3067\u8a00\u8a9e\u5207\u308a\u66ff\u3048\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6307\u5b9a(\u30c7\u30d5\u30a9\u30eb\u30c8\u306f locale) ?lang=ja \u7b49\u3092\u4ed8\u52a0\u3057\u3066\u5207\u308a\u66ff\u3048 <\/li>\n<li>messageSource \u306e basename \u3067\u30e1\u30c3\u30bb\u30fc\u30b8\u30d7\u30ed\u30d1\u30c6\u30a3\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30bf\u30fc\u30f3\u3092\u6307\u5b9a <\/li>\n<\/ul>\n<pre class=\"prettyprint linenums\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;beans xmlns=&quot;http:\/\/www.springframework.org\/schema\/beans&quot;\r\n    xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\r\n    xmlns:mvc=&quot;http:\/\/www.springframework.org\/schema\/mvc&quot;\r\n    xmlns:context=&quot;http:\/\/www.springframework.org\/schema\/context&quot;\r\n    xsi:schemaLocation=&quot;http:\/\/www.springframework.org\/schema\/beans http:\/\/www.springframework.org\/schema\/beans\/spring-beans-3.0.xsd\r\n        http:\/\/www.springframework.org\/schema\/mvc http:\/\/www.springframework.org\/schema\/mvc\/spring-mvc-3.0.xsd    \r\n        http:\/\/www.springframework.org\/schema\/context http:\/\/www.springframework.org\/schema\/context\/spring-context-3.0.xsd&quot;&gt;\r\n\r\n    &lt;mvc:annotation-driven\/&gt; \r\n    &lt;mvc:interceptors&gt; \r\n        &lt;bean id=&quot;localeChangeInterceptor&quot; class=&quot;org.springframework.web.servlet.i18n.LocaleChangeInterceptor&quot;&gt;\r\n            &lt;property name=&quot;paramName&quot; value=&quot;lang&quot; \/&gt;\r\n        &lt;\/bean&gt;\r\n    &lt;\/mvc:interceptors&gt;    \r\n    \r\n    &lt;bean id=&quot;messageSource&quot; class=&quot;org.springframework.context.support.ReloadableResourceBundleMessageSource&quot;&gt;\r\n        &lt;property name=&quot;basename&quot; value=&quot;WEB-INF\/i18n\/messages&quot;\/&gt;\r\n        &lt;property name=&quot;defaultEncoding&quot; value=&quot;UTF-8&quot; \/&gt;        \r\n    &lt;\/bean&gt;\r\n    \r\n    &lt;bean id=&quot;localeResolver&quot; class=&quot;org.springframework.web.servlet.i18n.CookieLocaleResolver&quot;&gt;\r\n        &lt;property name=&quot;cookieName&quot; value=&quot;locale&quot; \/&gt;\r\n    &lt;\/bean&gt;\r\n&lt;\/beans&gt;<\/pre>\n<h3>\u56fd\u969b\u5316\u5bfe\u5fdc\u7528\u8a2d\u5b9a\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b root-context.xml<\/h3>\n<p>\u4e0a\u8a18\u306e\u8a2d\u5b9a\u3092\u3001root-context.xml(web.xml \u306b\u3066\u3001DispatcherServlet \u306e contextConfigLocation \u306b\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb) \u304b\u3089\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b\u3002<\/p>\n<pre class=\"prettyprint linenums\">&lt;import resource=&quot;i18n.xml&quot;\/&gt;<\/pre>\n<h2>\u30bf\u30b0\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u30a8\u30e9\u30fc\u3068\u306a\u308b\u5834\u5408<\/h2>\n<p>\u5b9f\u884c\u3059\u308b\u3068\u3001\u30bf\u30b0\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u898b\u3064\u304b\u3089\u306a\u3044\u65e8\u306e\u30a8\u30e9\u30fc\u3068\u306a\u3063\u305f(\u672c\u6765\u306f\u30af\u30e9\u30b9\u30d1\u30b9\u306e TLD\u3092\u81ea\u52d5\u3067\u8a8d\u8b58\u3057\u3066\u304f\u308c\u308b\u306f\u305a\u306a\u306e\u304b\u306a\uff1f) \u304c\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u660e\u793a\u7684\u306b\u898b\u3064\u304b\u308b\u5834\u6240\u306b\u304a\u3044\u3066\u3042\u3052\u308b\u3053\u3068\u3067\u56de\u907f\u3002(<a href=\"http:\/\/stackoverflow.com\/questions\/1633414\/if-a-jar-is-placed-on-app-serverss-classpath-how-do-we-reference-it-from-jsp\">\u30af\u30e9\u30b9\u30ed\u30fc\u30c0\u304c\u7570\u306a\u308b\u306e\u304c\u554f\u984c\u3063\u307d\u3044<\/a>)<\/p>\n<p>org.springframework.web.servlet \u3092\u542b\u3080JAR\u3092\u5c55\u958b\u3059\u308b\u3068\u3001 \/META-INF\/spring.tld&#160; \u304c\u5b58\u5728\u3059\u308b\u306e\u3067\u3001\/WEB-INF \u3078\u30b3\u30d4\u30fc\u3057\u3066\u304a\u304d\u3001web.xml \u306b\u4ee5\u4e0b\u306e\u8a18\u8ff0\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<p>jsp-config \u306e\u8a18\u8ff0\u3092\u5fd8\u308c\u306a\u3044\u3088\u3046\u306b\u3002<\/p>\n<pre class=\"prettyprint linenums\">&lt;web-app&gt;\r\n     :\r\n    &lt;jsp-config&gt;\r\n        &lt;taglib&gt;\r\n            &lt;taglib-uri&gt;http:\/\/www.springframework.org\/tags&lt;\/taglib-uri&gt;\r\n            &lt;taglib-location&gt;\/WEB-INF\/spring.tld&lt;\/taglib-location&gt;\r\n        &lt;\/taglib&gt;\r\n    &lt;\/jsp-config&gt;<\/pre>\n<h2>JSP\u304b\u3089\u306e\u5229\u7528\u65b9\u6cd5<\/h2>\n<h3>\u30bf\u30b0\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u5ba3\u8a00\u3092\u30d5\u30a1\u30a4\u30eb\u5148\u982d\u3067\u884c\u3046<\/h3>\n<pre class=\"prettyprint linenums\">&lt;%@taglib uri=&quot;http:\/\/www.springframework.org\/tags&quot; prefix=&quot;spring&quot;%&gt;<\/pre>\n<h3>JSP\u3067\u51fa\u529b\u3059\u308b<\/h3>\n<pre class=\"prettyprint linenums\">&lt;spring:message code=&quot;label.firstname&quot;\/&gt;<\/pre>\n<h3>JSP\u3067\u5909\u6570\u306b\u8a2d\u5b9a(JSTL \u306e c:set&#160; EL\u5f0f\u3084\u3001JSTL\u304b\u3089\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b)<\/h3>\n<pre class=\"prettyprint linenums\">&lt;spring:message code=&quot;label.firstname&quot; var=&quot;firstname&quot; scope=&quot;page&quot;\/&gt;<\/pre>\n<p>\u3068\u3059\u308b\u3068<\/p>\n<pre class=\"prettyprint linenums\">${firstname}<\/pre>\n<p>\u3067\u5229\u7528\u3067\u304d\u308b\u3002<\/p>\n<h2>\u30d6\u30e9\u30a6\u30b6\u306e\u8a00\u8a9e\u3092\u5909\u66f4\u3059\u308b<\/h2>\n<p>\u3061\u306a\u307f\u306b\u3001IE\u306e\u8a00\u8a9e\u3092\u8a2d\u5b9a\u3059\u308b\u306b\u306f\u3001\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30aa\u30d7\u30b7\u30e7\u30f3\u304b\u3089\u3001\u8a00\u8a9e\u3092\u9078\u629e\u3059\u308b<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/SpringMVC_A643\/spring_i18n01.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px\" title=\"spring_i18n01\" border=\"0\" alt=\"spring_i18n01\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/SpringMVC_A643\/spring_i18n01_thumb.jpg\" width=\"433\" height=\"333\" \/><\/a> <\/p>\n<p>\u3053\u306e\u672c\u306f\u3001\u975e\u5e38\u306b\u308f\u304b\u308a\u3084\u3059\u304f\u3066\u826f\u304b\u3063\u305f\u3051\u3069\u3001\u56fd\u969b\u5316\u5bfe\u5fdc\u306e\u8a18\u8ff0\u306f<\/p>\n<p>\u306a\u304b\u3063\u305f\u306a\u30fc<\/p>\n<p>&#160;<a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4797358114\/ref=as_li_ss_il?ie=UTF8&amp;tag=typea09-22&amp;linkCode=as2&amp;camp=247&amp;creative=7399&amp;creativeASIN=4797358114\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/ws.assoc-amazon.jp\/widgets\/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=4797358114&amp;MarketPlace=JP&amp;ID=AsinImage&amp;WS=1&amp;tag=typea09-22&amp;ServiceVersion=20070822\" \/><\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"border-bottom-style: none !important; border-right-style: none !important; margin: 0px; border-top-style: none !important; border-left-style: none !important\" border=\"0\" alt=\"\" src=\"http:\/\/www.assoc-amazon.jp\/e\/ir?t=typea09-22&amp;l=as2&amp;o=9&amp;a=4797358114\" width=\"1\" height=\"1\" \/> <a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4797358114\/ref=as_li_ss_tl?ie=UTF8&amp;tag=typea09-22&amp;linkCode=as2&amp;camp=247&amp;creative=7399&amp;creativeASIN=4797358114\">Spring\u306b\u3088\u308bWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b9\u30fc\u30d1\u30fc\u30b5\u30f3\u30d7\u30eb \u7b2c2\u7248<\/a><img loading=\"lazy\" decoding=\"async\" style=\"border-bottom-style: none !important; border-right-style: none !important; margin: 0px; border-top-style: none !important; border-left-style: none !important\" border=\"0\" alt=\"\" src=\"http:\/\/www.assoc-amazon.jp\/e\/ir?t=typea09-22&amp;l=as2&amp;o=9&amp;a=4797358114\" width=\"1\" height=\"1\" \/><\/p>\n<p>\u82f1\u8a9e\u3060\u3051\u3069\u3001Spring Security \u5468\u308a\u306e\u8a18\u8ff0\u304c\u308f\u304b\u308a\u3084\u3059\u3044\u3002\u3057\u304b\u3082\u96fb\u5b50\u66f8\u7c4d\u304c\u7121\u6599\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u6a29\u5229\u4ed8\u304d\u3067\u304a\u5f97\u3002<\/p>\n<p><a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/1935182358\/ref=as_li_ss_il?ie=UTF8&amp;tag=typea09-22&amp;linkCode=as2&amp;camp=247&amp;creative=7399&amp;creativeASIN=1935182358\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/ws.assoc-amazon.jp\/widgets\/q?_encoding=UTF8&amp;Format=_SL160_&amp;ASIN=1935182358&amp;MarketPlace=JP&amp;ID=AsinImage&amp;WS=1&amp;tag=typea09-22&amp;ServiceVersion=20070822\" \/><\/a><img loading=\"lazy\" decoding=\"async\" style=\"border-bottom-style: none !important; border-right-style: none !important; margin: 0px; border-top-style: none !important; border-left-style: none !important\" border=\"0\" alt=\"\" src=\"http:\/\/www.assoc-amazon.jp\/e\/ir?t=typea09-22&amp;l=as2&amp;o=9&amp;a=1935182358\" width=\"1\" height=\"1\" \/> <\/p>\n<p><a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/1935182358\/ref=as_li_ss_tl?ie=UTF8&amp;tag=typea09-22&amp;linkCode=as2&amp;camp=247&amp;creative=7399&amp;creativeASIN=1935182358\">Spring in Action<\/a><img loading=\"lazy\" decoding=\"async\" style=\"border-bottom-style: none !important; border-right-style: none !important; margin: 0px; border-top-style: none !important; border-left-style: none !important\" border=\"0\" alt=\"\" src=\"http:\/\/www.assoc-amazon.jp\/e\/ir?t=typea09-22&amp;l=as2&amp;o=9&amp;a=1935182358\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3092\u3001\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u884c\u3046\u3002\u30fb\u30fb\u30fb\u3082\u3001\u82e5\u5e72\u624b\u3053\u305a\u3063\u305f\u306e\u3067\u624b\u9806\u3092\u30e1\u30e2\u3057\u3066\u304a\u304f\u3002 Spring 3 MVC: Internationalization &amp; Localization Tutorial with Ex [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[47],"tags":[],"class_list":["post-312","post","type-post","status-publish","format-standard","hentry","category-spring"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=312"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/312\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}