请求的资源不可用html,Spring MVC请求的资源不可用

我有一个带有公共函数索引()的单个控制器类(MainController.class)的战争项目,该函数返回一个字符串,该字符串是我最后一次检查视图的名称正在转发 - 和一个名为“index.jsp”的jsp。这些视图位于/ main/webapp/WEB-INF/views/jsp /中。 MainController.java:Spring MVC请求的资源不可用

@Controller

public class MainController

{

@Autowired

private ApplicationContextProvider mObjApplicationContextProvider;

@Autowired

private ScheduleService mObjScheduleService;

protected ApplicationContext getApplicationContext()

{

return(getApplicationContextProvider().getApplicationContext());

}

protected ApplicationContextProvider getApplicationContextProvider()

{

return(mObjApplicationContextProvider);

}

protected Object getBean(final Class> clsBean)

{

return(getApplicationContext().getBean(clsBean));

}

protected Object getBean(final String sBeanName)

{

return(getApplicationContext().getBean(sBeanName));

}

protected ScheduleService getScheduleService()

{

return(mObjScheduleService);

}

@RequestMapping(value="/")

public String index()

{

return("index");

}

}

的index.jsp:

Insert title here

Hello World!

我的XML配置文件:

xmlns:context="http://www.springframework.org/schema/context"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xmlns:mvc="http://www.springframework.org/schema/mvc"

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.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://localhost:8080/Ushering/ “:404 - ”请求的资源不可用。“

我在日志中找不到任何东西(但可以发布,如有必要)告诉我什么文件或资源无法使用。它似乎能够找到控制器,因为它在一个日志文件中提到了控制器的请求映射。会是什么呢?

编辑:WAR文件按照在pom文件中定义的方式启动,也在web.xml中作为项目的名称,所以我会认为上下文将是启动以及任何在Spring应用程序端的事情会在/引发之后,所以如果我将请求映射设置为/ Hello,那么URL应该是localhost:8080/Ushering/Hello。

编辑:我的web.xml文件

CrunchifySpringMVCTutorial

index.jsp

Ushering

org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

/WEB-INF/Ushering-config.xml

1

Ushering

/s

+0

你能发布你的web.xml文件吗? –

+0

将其添加为编辑 –

+0

我明白了!当我将web.xml -/s贴在底部附近的url-pattern中时,我注意到了一个错字。它应该是/且只有/。我删除了's',干净的编译战争:战争编辑它,它出现了,因为我期待:-D谢谢你在正确的方向戳我! –

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值