Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI in DispatcherServlet with name 'appServlet'
  2.  
  3. <?xml version="1.0" encoding="UTF-8"?>
  4.  
  5. <!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
  6. <context-param>
  7. <param-name>contextConfigLocation</param-name>
  8. <param-value>/WEB-INF/spring/root-context.xml</param-value>
  9. </context-param>
  10.  
  11. <!-- Creates the Spring Container shared by all Servlets and Filters -->
  12. <listener>
  13. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  14. </listener>
  15.  
  16. <!-- Processes application requests -->
  17. <servlet>
  18. <servlet-name>appServlet</servlet-name>
  19. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  20. <init-param>
  21. <param-name>contextConfigLocation</param-name>
  22. <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
  23. </init-param>
  24. <load-on-startup>1</load-on-startup>
  25. </servlet>
  26.  
  27. <servlet-mapping>
  28. <servlet-name>appServlet</servlet-name>
  29. <url-pattern>/</url-pattern>
  30. </servlet-mapping>
  31.  
  32. <beans xmlns="http://www.springframework.org/schema/beans"
  33. xmlns:context="http://www.springframework.org/schema/context"
  34. xmlns:mvc="http://www.springframework.org/schema/mvc"
  35. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  36. xmlns:tx="http://www.springframework.org/schema/tx"
  37. xsi:schemaLocation="http://www.springframework.org/schema/beans
  38. http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  39. http://www.springframework.org/schema/mvc
  40. http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
  41. http://www.springframework.org/schema/context
  42. http://www.springframework.org/schema/context/spring-context-4.0.xsd
  43. http://www.springframework.org/schema/tx
  44. http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
  45.  
  46. <!-- DispatcherServlet Context: defines this servlet's request-processing
  47. infrastructure -->
  48.  
  49. <!-- Enables the Spring MVC @Controller programming model -->
  50. <!-- <annotation-driven /> -->
  51. <!-- <context:annotation-config/> -->
  52. <mvc:annotation-driven />
  53.  
  54. <!-- Handles HTTP GET requests for /resources/** by efficiently serving
  55. up static resources in the ${webappRoot}/resources directory -->
  56. <!-- <resources mapping="/resources/**" location="/resources/" /> -->
  57.  
  58. <!-- Resolves views selected for rendering by @Controllers to .jsp resources
  59. in the /WEB-INF/views directory -->
  60. <bean
  61. class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  62. <property name="prefix" value="/WEB-INF/views/" />
  63. <property name="suffix" value=".jsp" />
  64. </bean>
  65.  
  66. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
  67. destroy-method="close">
  68. <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  69. <property name="url"
  70. value="jdbc:mysql://localhost:3306/TestDB" />
  71. <property name="username" value="root" />
  72. <property name="password" value="root" />
  73. </bean>
  74.  
  75. <!-- Hibernate 4 SessionFactory Bean definition -->
  76. <bean id="hibernate4AnnotatedSessionFactory"
  77. class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  78. <property name="dataSource" ref="dataSource" />
  79. <property name="annotatedClasses">
  80. <list>
  81. <value>com.mahender.web.model.Person</value>
  82. </list>
  83. </property>
  84. <property name="hibernateProperties">
  85. <props>
  86. <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect
  87. </prop>
  88. <prop key="hibernate.show_sql">true</prop>
  89. </props>
  90. </property>
  91. </bean>
  92.  
  93. <bean id="personDAO" class="com.mahender.web.DAO.PersonDAOImpl">
  94. <property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" />
  95. </bean>
  96. <bean id="personService" class="com.mahender.web.service.PersonServiceImpl">
  97. <property name="personDAO" ref="personDAO"></property>
  98. </bean>
  99. <context:component-scan base-package="com.mahender.web" />
  100.  
  101. <tx:annotation-driven transaction-manager="transactionManager"/>
  102.  
  103. <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
  104. <property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" />
  105. </bean>
  106.  
  107. @RequestMapping(value = "/app")
  108.  
  109. private PersonService personService;
  110.  
  111. @Autowired(required=true)
  112. @Qualifier(value="personService")
  113. public void setPersonService(PersonService ps){
  114. this.personService = ps;
  115. }
  116.  
  117. @RequestMapping(value = "/persons", method = RequestMethod.GET)
  118. public String listPersons(Model model) {
  119. model.addAttribute("person", new Person());
  120. model.addAttribute("listPersons", this.personService.listPersons());
  121. return "person";
  122. }
  123.  
  124. <c:url var="addAction" value="/person/add" ></c:url>
  125.  
  126. <form:form action="${addAction}" commandName="person">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement