1

Any help would be greatly appreciated!

This is my controller :

package com.tingkytalk.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class MainController  {

@RequestMapping("/")
public String frontPage(){
    System.out.println("Controller called");
    return "snoop";
}}

and this is my web xml :

<servlet>
    <servlet-name>mvc-dispatcher</servlet-name>
    <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>mvc-dispatcher</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

and this is my spring-config.xml :

<context:component-scan base-package ="com.tingkytalk.controller"/>
<mvc:annotation-driven/>
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <property name="viewClass"
              value="org.springframework.web.servlet.view.JstlView" />
    <property name="prefix" value="/WEB-INF/views/" />
    <property name="suffix" value=".jsp" />
</bean>

I have snoop.jsp in WEB-INF/views/ and iam using JBOSS AS7 with openshift as deployment server. And this is error that i had :

No mapping found for HTTP request with URI [/] in DispatcherServlet with name 'mvc-dispatcher'

Please help me, what am i doing wrong? I already try other post solution but it's still not working T_T

Paweł Tomkiel
  • 1,974
  • 2
  • 21
  • 39
Handzo
  • 11
  • 2

0 Answers0