Я пытаюсь получить значения из моей базы правил и показать их на веб-странице, когда пользователь вводит данные и отправляет их на веб-страницу. Тем не менее, я получаю сообщение об ошибке при запуске моего кода. Вот фрагмент ошибки, который я получаю ниже. Если я запускаю код без использования файлов JSP, он запускается и получает правильную информацию из базы правил. Любые выводы будут оценены.
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Jan 31 11:10:39 IST 2020
There was an unexpected error (type=Internal Server Error, status=500).
Unable to compile class for JSP: An error occurred at line: [23] in the generated java file: [C:\Users\Lenovo\AppData\Local\Temp\tomcat.4918599868642578536.8080\work\Tomcat\localhost\ROOT\org\apache\jsp\WEB_002dINF\view\selectview_jsp.java] Syntax error, parameterized types are only available if source level is 1.5 or greater An error occurred at line: [25] in the generated java file:[C:\Users\Lenovo\AppData\Local\Temp\tomcat.4918599868642578536.8080\work\Tomcat\localhost\ROOT\org\apache\jsp\WEB_002dINF\view\selectview_jsp.java] Syntax error, parameterized types are only available if source level is 1.5 or greater An error occurred at line: [30] in the generated java file: [C:\Users\Lenovo\AppData\Local\Temp\tomcat.4918599868642578536.8080\work\Tomcat\localhost\ROOT\org\apache\jsp\WEB_002dINF\view\selectview_jsp.java] '<>' operator is not allowed for source level below 1.7 An error occurred at line: [30] in the generated java file: [C:\Users\Lenovo\AppData\Local\Temp\tomcat.4918599868642578536.8080\work\Tomcat\localhost\ROOT\org\apache\jsp\WEB_002dINF\view\selectview_jsp.java] Incorrect number of arguments for type HashSet<E>; it cannot be parameterized with arguments <> An error occurred at line: [34] in the generated java file:
Stacktrace:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [23] in the generated java file: [C:\Users\Lenovo\AppData\Local\Temp\tomcat.4918599868642578536.8080\work\Tomcat\localhost\ROOT\org\apache\jsp\WEB_002dINF\view\selectview_jsp.java] Syntax error, parameterized types are only available if source level is 1.5 or greater
An error occurred at line: [25] in the generated java file:[C:\Users\Lenovo\AppData\Local\Temp\tomcat.4918599868642578536.8080\work\Tomcat\localhost\ROOT\org\apache\jsp\WEB_002dINF\view\selectview_jsp.java] Syntax error, parameterized types are only available if source level is 1.5 or greater
Ниже приведен файл pom. xml, который я настроил:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.sample.project</groupId>
<artifactId>SampleProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>RMS</name>
<description>Demo project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<kie.version>6.1.0.Final</kie.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
<version>${kie.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<!--dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency-->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
</plugins>
</build>
Ниже приведен мой класс контроллера:
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import com.gmoney.rms.model.Invoice_Process;
import com.gmoney.rms.service.RmsService;
@RestController
public class RulesController {
@Autowired
private SampleService sampleService;
@RequestMapping("/welcome")
public ModelAndView index() {
System.out.println("Hi, Welcome");
return new ModelAndView("selectview");
}
@GetMapping("/next")
public ModelAndView secondPage(Map<String, Object> model) {
model.put("message","message");
return new ModelAndView("next");
}
Ниже приведен файл JSP, из которого я должен получить информацию от пользователя из Интернета, и он должен получить информацию из контроллера ":
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>Welcome to the Invoice page</h1>
<label>Please select the Payer name: </label>
<select name='Name'>
<option value="">Select</option>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
<option value="d">d</option>
</select>
<br>
<button>Submit</button>
<a id='linkid' href="next"></a>
Click on this <strong><a href='next'>link</a></strong>to get results page
</body>
</html>