Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc 在web.xml中添加ContextLoaderListener后。404错误为;请求的资源()不可用;_Spring Mvc - Fatal编程技术网

Spring mvc 在web.xml中添加ContextLoaderListener后。404错误为;请求的资源()不可用;

Spring mvc 在web.xml中添加ContextLoaderListener后。404错误为;请求的资源()不可用;,spring-mvc,Spring Mvc,在我的spring mvc应用程序中,当我在web.xml文件中添加applicationContext.xml时: <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param&

在我的spring mvc应用程序中,当我在web.xml文件中添加applicationContext.xml时:

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
SpringJdbcService.java

package com.ankit.service;

import com.ankit.beans.Employee;

public interface SpringJdbcService {

    Employee searchMemDts(Employee vngmem);

    void insertMemDts(Employee MemDtlsbean);

}
SpringJdbcServiceImpl.java

package com.ankit.service.impl;

import org.springframework.jdbc.BadSqlGrammarException;
import org.springframework.stereotype.Service;

import com.ankit.beans.Employee;
import com.ankit.service.SpringJdbcService;

@Service
public class SpringJdbcServiceImpl implements SpringJdbcService {

    public Employee searchMemDts(Employee vngmem) {
        try {
            vngmem.setEmployeeName("Ankit");
            return vngmem;
        } catch (BadSqlGrammarException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
我正试图点击以下网址:
localhost:8085/mvc/searchJdbcContact.html

您可能应该阅读以下内容:。但您提供的信息不足以确定问题。我们不知道您的配置看起来像什么,您的映射是什么,以及您试图访问哪个URL。您的根和web上下文应该分为两个seprate配置。控制器/mvc Annotion在web上下文中定义。
package com.ankit.service;

import com.ankit.beans.Employee;

public interface SpringJdbcService {

    Employee searchMemDts(Employee vngmem);

    void insertMemDts(Employee MemDtlsbean);

}
package com.ankit.service.impl;

import org.springframework.jdbc.BadSqlGrammarException;
import org.springframework.stereotype.Service;

import com.ankit.beans.Employee;
import com.ankit.service.SpringJdbcService;

@Service
public class SpringJdbcServiceImpl implements SpringJdbcService {

    public Employee searchMemDts(Employee vngmem) {
        try {
            vngmem.setEmployeeName("Ankit");
            return vngmem;
        } catch (BadSqlGrammarException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}