Quantcast
Channel: Spring Community Forums - NoSQL
Viewing all articles
Browse latest Browse all 128

@Controller Annotation Never Gets Called

$
0
0
I am trying to develop an app using neo4j database. I am completely new to this service but made a few classes to test it out. One of my classes is the controller but when I debug the index.jsp launches but nothing else happens, the methods do not get called. Maybe you guys can help me figure this out.

Web XML.
Code:

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
        version="3.0">
   
    <context-param>
            <param-name>contextClass</param-name>
            <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
        </context-param>

        <!-- Location of Java @Configuration classes that configure the components that makeup this application -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>com.mycompany.smsdatabase.controller</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>

        <!-- Ensure UTF-8 character encoding is used -->
        <filter>
                <filter-name>encodingFilter</filter-name>
                <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
                <init-param>
                        <param-name>encoding</param-name>
                        <param-value>UTF-8</param-value>
                </init-param>
                <init-param>
                        <param-name>forceEncoding</param-name>
                        <param-value>true</param-value>
                </init-param>
        </filter>

        <filter-mapping>
                <filter-name>encodingFilter</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>

        <!-- Enables support for DELETE and PUT request methods with web browser clients -->
        <filter>
                <filter-name>hiddenHttpMethodFilter</filter-name>
                <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
        </filter>

        <filter-mapping>
                <filter-name>hiddenHttpMethodFilter</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>

        <servlet>
                <servlet-name>appServlet</servlet-name>
                <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
                <init-param>
                        <param-name>contextConfigLocation</param-name>
                        <param-value></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>

Controller Class
Code:

package com.mycompany.smsdatabase.controller;

import com.mycompany.smsdatabase.service.PersonImport;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
public class HomeController {
    private PersonImport personImport;
    @RequestMapping(value = "/SMSDatabase", method = RequestMethod.GET)
    public String Home()
    {
      personImport.doImportPerson("anthony");
      return "index";
    }
}


Viewing all articles
Browse latest Browse all 128

Trending Articles