Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI in DispatcherServlet with name 'appServlet'
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/spring/root-context.xml</param-value>
- </context-param>
- <!-- Creates the Spring Container shared by all Servlets and Filters -->
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <!-- Processes application requests -->
- <servlet>
- <servlet-name>appServlet</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>appServlet</servlet-name>
- <url-pattern>/</url-pattern>
- </servlet-mapping>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-4.0.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
- <!-- DispatcherServlet Context: defines this servlet's request-processing
- infrastructure -->
- <!-- Enables the Spring MVC @Controller programming model -->
- <!-- <annotation-driven /> -->
- <!-- <context:annotation-config/> -->
- <mvc:annotation-driven />
- <!-- Handles HTTP GET requests for /resources/** by efficiently serving
- up static resources in the ${webappRoot}/resources directory -->
- <!-- <resources mapping="/resources/**" location="/resources/" /> -->
- <!-- Resolves views selected for rendering by @Controllers to .jsp resources
- in the /WEB-INF/views directory -->
- <bean
- class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="prefix" value="/WEB-INF/views/" />
- <property name="suffix" value=".jsp" />
- </bean>
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
- destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url"
- value="jdbc:mysql://localhost:3306/TestDB" />
- <property name="username" value="root" />
- <property name="password" value="root" />
- </bean>
- <!-- Hibernate 4 SessionFactory Bean definition -->
- <bean id="hibernate4AnnotatedSessionFactory"
- class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource" />
- <property name="annotatedClasses">
- <list>
- <value>com.mahender.web.model.Person</value>
- </list>
- </property>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect
- </prop>
- <prop key="hibernate.show_sql">true</prop>
- </props>
- </property>
- </bean>
- <bean id="personDAO" class="com.mahender.web.DAO.PersonDAOImpl">
- <property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" />
- </bean>
- <bean id="personService" class="com.mahender.web.service.PersonServiceImpl">
- <property name="personDAO" ref="personDAO"></property>
- </bean>
- <context:component-scan base-package="com.mahender.web" />
- <tx:annotation-driven transaction-manager="transactionManager"/>
- <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
- <property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" />
- </bean>
- @RequestMapping(value = "/app")
- private PersonService personService;
- @Autowired(required=true)
- @Qualifier(value="personService")
- public void setPersonService(PersonService ps){
- this.personService = ps;
- }
- @RequestMapping(value = "/persons", method = RequestMethod.GET)
- public String listPersons(Model model) {
- model.addAttribute("person", new Person());
- model.addAttribute("listPersons", this.personService.listPersons());
- return "person";
- }
- <c:url var="addAction" value="/person/add" ></c:url>
- <form:form action="${addAction}" commandName="person">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement