Java Spring MVC-无法解析视图(.jsp)
我一直在尝试运行Spring5.1.6MCV应用程序;我的应用程序一直工作到到达控制器的点,但是还没有到达视图点。我面临404错误 我尝试运行另一个web应用程序,检查Tomcat设置(v9.0)是否有问题 我希望你们能看到我没看到的错误。我很确定我漏掉了什么 我的pom.XMLJava Spring MVC-无法解析视图(.jsp),java,spring,spring-mvc,Java,Spring,Spring Mvc,我一直在尝试运行Spring5.1.6MCV应用程序;我的应用程序一直工作到到达控制器的点,但是还没有到达视图点。我面临404错误 我尝试运行另一个web应用程序,检查Tomcat设置(v9.0)是否有问题 我希望你们能看到我没看到的错误。我很确定我漏掉了什么 我的pom.XML <dependencies> <!-- Spring --> <dependency> <groupId>org.springfram
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>5.1.6.RELEASE</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.2.Final</version>
</dependency>
<!-- Java 8 and Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-java8</artifactId>
<version>5.4.2.Final</version>
</dependency>
<!-- jsr303 validation -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<!-- ORACLE -->
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>11g</version>
<scope>system</scope>
<systemPath>/Users/diegooviedosantana/Google Drive/Proyectos/Java/Java DataBases/Documentation/DataBase/ojdbc6.jar</systemPath>
</dependency>
<!-- Servlet+JSP+JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!--TOMCAT -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>9.0.1</version>
</dependency>
<!-- Testing dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.6.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
<scope>test</scope>
</dependency>
我的控制器
@Controller
@RequestMapping("/Applicants")
@ComponentScan("com.MyCVOnline")
public class AppController {
@Autowired
ApplicantService applicant_service;
@Autowired
MessageSource messageSource;
// This method will list all existing employees.
@RequestMapping(value = { "/All-Applicants" }, method = RequestMethod.GET)
public String getAllApplicants(ModelMap model) {
ArrayList<Applicant> applicants = applicant_service.retreiveApplicants();
model.addAttribute("applicants", applicants);
System.out.println("Works untill contoller call");
return "AllApplicants";
}
}
@控制器
@请求映射(“/申请人”)
@组件扫描(“com.MyCVOnline”)
公共类AppController{
@自动连线
申请者服务申请者服务;
@自动连线
消息源消息源;
//此方法将列出所有现有员工。
@RequestMapping(值={“/所有申请者”},方法=RequestMethod.GET)
公共字符串GetAllApplications(ModelMap模型){
ArrayList
我的错误
然后,我试图通过从路径中删除项目名称来修改前缀
以前
之后
然后我的404错误更改为
以及我的日志:
但我仍然无法联系到JSP
另外,请随时通过我的github链接查看整个项目
不确定我的项目结构是否会影响
任何形式的帮助都将不胜感激
@Controller
@RequestMapping("/Applicants")
@ComponentScan("com.MyCVOnline")
public class AppController {
@Autowired
ApplicantService applicant_service;
@Autowired
MessageSource messageSource;
// This method will list all existing employees.
@RequestMapping(value = { "/All-Applicants" }, method = RequestMethod.GET)
public String getAllApplicants(ModelMap model) {
ArrayList<Applicant> applicants = applicant_service.retreiveApplicants();
model.addAttribute("applicants", applicants);
System.out.println("Works untill contoller call");
return "AllApplicants";
}
}
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Applicant List</title>
</head>
<body>
Applicants: <br>
<table>
<thead>
<th>APPLICANT ID</th>
<th>NAME</th>
<th>PROFESSION</th>
</thead>
<c:forEach var="applicant" items="${applicants}">
<tbody>
<td>${applicant.nombre}</td>
<td>${applicant.appellido} ${applicant.lastName}</td>
<td>${applicant.profession}</td>
</tbody>
</c:forEach>
</table>
</body>
</html>