web.xmlの構成
<! - 配置春-MVC拦截- > < サーブレット> < サーブレット名>のDispatcherServlet </ サーブレット名> < サーブレットクラス> org.springframework.web.servlet.DispatcherServlet </ サーブレットクラス> < ロード-オンスタートアップ> 1 </ のload-on-startup > </ サーブレット> < のservlet-mapping > < サーブレット名>のDispatcherServlet </ サーブレット名> < のurl-pattern >*。行う</ のurl-pattern > </ のservlet-mapping >
春のコンフィギュレーションファイル:のDispatcherServlet-servlet.xml
<?= "1.0"エンコード= "UTF-8" XMLバージョン?> < 豆のxmlns = "http://www.springframework.org/schema/beans" のxmlns:XSI = "http://www.w3.org/2001 / XMLスキーマ・インスタンス" のxmlns:MVC = "http://www.springframework.org/schema/mvc" のxmlns:コンテキスト= "http://www.springframework.org/schema/context" のxmlns:AOP =" HTTP: //www.springframework.org/schema/aop " のxmlns:TX = "http://www.springframework.org/schema/tx" のxsi:schemaLocationの=" http://www.springframework.org/schema/beans のhttp ://www.springframework.org/schema/beans/spring-beans-3.2。 http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring- 3.2.xsdコンテキスト http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema / TX http://www.springframework.org/schema/tx/spring-tx-3.2.xsd " > <! - 1の構成プロセッサマッピング、springmvcデフォルトのハンドラマッパー BeanNameUrlHandlerMapping:豆のname属性handlerControllerを見つけるためのURL - > < 豆のクラス= "org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" > </Beanは> <! - キーと一致したURLの簡単なURLをブラウザによると、キーはコントローラコントローラIDを見つけることです> - !- < 使用されていない:注意- > <! - <beanクラス=「org.springframeworkを。 web.servlet.handler.SimpleUrlHandlerMapping "> <プロパティ名="マッピング"> <小道具> <小道具キー=" / user1.do "> UserControllerで</小道具> <小道具キー=" / user2.do「> UserControllerで</小道具> <小道具キー= "/ user3.do"> UserControllerで</小道具> </小道具> </プロパティ> </豆> - > <! - クラス名クラス名(MyControllerによります)。クラス名が落ちる資本の傍受の後ろ中央に表示された場合、テスト結果、クラス名の最初の文字を小文字にアクセスするために行う> - < 豆のクラスを= "org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" > </ ビーン> <! - 2.構成プロセッサ構成アダプターを行うコントローラ- > < ビーンクラス=「org.springframework.web.servlet.mvc .SimpleControllerHandlerAdapter「> </ ビーン> <! - 上記の処理アダプタと共存することができ、差がHttpRequestHandlerインタフェースを達成することで、インタフェースは値を返さない> - < ビーンクラスorg.springframework.web.servlet.mvc.HttpRequestHandlerAdapter "=」> </ 豆> <! - 3のconfigureコントローラ- > < 豆の名前= "/ userController.do" クラス= "com.royal.backoffice.web.controller.UserController" > </ 豆> <! - 4.配置springmvc视图解析器- > < 豆のクラス= "org.springframework.web.servlet.view.InternalResourceViewResolver" > < プロパティ名= "接頭辞" 値= "WEB-INF /ビュー/" /> < プロパティ名= "サフィックス" 値= "JSP" /> </ 豆> </ 豆>