Advertisement
Guest User

Untitled

a guest
Jun 9th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.77 KB | None | 0 0
  1. <?xml version='1.0' encoding='UTF-8' ?>
  2. <!-- was: <?xml version="1.0" encoding="UTF-8"?> -->
  3. <beans xmlns="http://www.springframework.org/schema/beans"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xmlns:p="http://www.springframework.org/schema/p"
  6. xmlns:aop="http://www.springframework.org/schema/aop"
  7. xmlns:tx="http://www.springframework.org/schema/tx"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  9. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
  10. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
  11.  
  12. <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
  13. <!-- the application context definition for the springapp DispatcherServlet -->
  14.  
  15. <!--<bean name="/index.htm" class="com.fernando.controller"/>-->
  16.  
  17.  
  18. <!--
  19. Most controllers will use the ControllerClassNameHandlerMapping above, but
  20. for the index controller we are using ParameterizableViewController, so we must
  21. define an explicit mapping for it.
  22. -->
  23. <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
  24. <property name="mappings">
  25. <props>
  26. <prop key="index.htm">indexController</prop>
  27. </props>
  28. </property>
  29. </bean>
  30.  
  31. <bean id="viewResolver"
  32. class="org.springframework.web.servlet.view.InternalResourceViewResolver"
  33. p:prefix="/WEB-INF/jsp/"
  34. p:suffix=".jsp" />
  35.  
  36. <!--
  37. The index controller.
  38. -->
  39. <bean name="indexController"
  40. class="org.springframework.web.servlet.mvc.ParameterizableViewController"
  41. p:viewName="index" />
  42.  
  43. </beans>
  44.  
  45. <?xml version="1.0" encoding="UTF-8"?>
  46. <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
  47. <context-param>
  48. <param-name>contextConfigLocation</param-name>
  49. <param-value>/WEB-INF/applicationContext.xml</param-value>
  50. </context-param>
  51. <listener>
  52. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  53. </listener>
  54. <servlet>
  55. <servlet-name>dispatcher</servlet-name>
  56. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  57. <load-on-startup>2</load-on-startup>
  58. </servlet>
  59. <servlet-mapping>
  60. <servlet-name>dispatcher</servlet-name>
  61. <url-pattern>*.htm</url-pattern>
  62. </servlet-mapping>
  63. <session-config>
  64. <session-timeout>
  65. 30
  66. </session-timeout>
  67. </session-config>
  68. <welcome-file-list>
  69. <welcome-file>redirect.jsp</welcome-file>
  70. </welcome-file-list>
  71. </web-app>
  72.  
  73. /*
  74. * SpringMVC
  75. * CopyRight Rech Informática Ltda. Todos os direitos reservados.
  76. */
  77. package com.fernando.controller;
  78.  
  79. import org.springframework.stereotype.Controller;
  80. import org.springframework.ui.Model;
  81. import org.springframework.web.bind.annotation.RequestMapping;
  82. import org.springframework.web.bind.annotation.RequestMethod;
  83.  
  84. /**
  85. * Descrição da classe.
  86. */
  87. @Controller
  88. public class IndexController {
  89.  
  90. @RequestMapping("/index")
  91. //@RequestMapping(value = "/index",method = RequestMethod.GET)
  92. public String index(Model model) {
  93. model.addAttribute("message", "Hello World!");
  94. return "index";
  95. }
  96. }
  97.  
  98. <%@page contentType="text/html" pageEncoding="UTF-8"%>
  99. <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
  100. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  101. "http://www.w3.org/TR/html4/loose.dtd">
  102.  
  103. <html>
  104. <head>
  105. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  106. <title>Welcome to Spring Web MVC project</title>
  107.  
  108. <spring:url value="/resources/css/index.css" var="mainCss" />
  109. <link href="${mainCss}" rel="stylesheet" />
  110.  
  111. </head>
  112.  
  113. <body>${message}
  114. <p>${message} Hello! This is the default welcome page for a Spring Web MVC project.</p>
  115. <p><i>To display a different welcome page for this project, modify</i>
  116. <tt>index.jsp</tt> <i>, or create your own welcome page then change
  117. the redirection in</i> <tt>redirect.jsp</tt> <i>to point to the new
  118. welcome page and also update the welcome-file setting in</i>
  119. <tt>web.xml</tt>.</p>
  120. </body>
  121. </html>
  122.  
  123. <?xml version='1.0' encoding='UTF-8' ?>
  124. <!-- was: <?xml version="1.0" encoding="UTF-8"?> -->
  125. <beans xmlns="http://www.springframework.org/schema/beans"
  126. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  127. xmlns:p="http://www.springframework.org/schema/p"
  128. xmlns:aop="http://www.springframework.org/schema/aop"
  129. xmlns:tx="http://www.springframework.org/schema/tx"
  130. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  131. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
  132. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
  133.  
  134. <!--bean id="propertyConfigurer"
  135. class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
  136. p:location="/WEB-INF/jdbc.properties" />
  137.  
  138. <bean id="dataSource"
  139. class="org.springframework.jdbc.datasource.DriverManagerDataSource"
  140. p:driverClassName="${jdbc.driverClassName}"
  141. p:url="${jdbc.url}"
  142. p:username="${jdbc.username}"
  143. p:password="${jdbc.password}" /-->
  144.  
  145. <!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) -->
  146.  
  147. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement