This commit is contained in:
zeliu
2019-03-24 15:18:22 -06:00
66 changed files with 2845 additions and 617 deletions
@@ -1,33 +1,12 @@
package edu.msudenver.tsp.website;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import java.util.Arrays;
@Slf4j
@SpringBootApplication
public class Application {
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public CommandLineRunner commandLineRunner(final ApplicationContext ctx) {
return args -> {
LOG.info("Beans provided by Spring Boot:");
final String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (final String beanName : beanNames) {
LOG.info(beanName);
}
};
}
}
@@ -1,4 +0,0 @@
package edu.msudenver.tsp.website;
public class ProofsDriver {
}
@@ -0,0 +1,33 @@
package edu.msudenver.tsp.website.controller;
import edu.msudenver.tsp.website.forms.TheoremForm;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Slf4j
@Controller
@AllArgsConstructor
@RequestMapping("/theorem")
public class TheoremEntryController {
@GetMapping({"/",""})
public ModelAndView enterTheoremPage() {
LOG.info("Received request to display the theorem entry page: returning model with name 'Theorem'");
return new ModelAndView("Theorem");
}
@PostMapping({"/",""})
public String saveTheorem(@Validated final TheoremForm theoremForm, final Model model) {
model.addAttribute("theoremName", theoremForm.getTheoremName());
model.addAttribute("theorem", theoremForm.getTheorem());
LOG.info("Saving theorem {}...", theoremForm);
return "success";
}
}
@@ -0,0 +1,11 @@
package edu.msudenver.tsp.website.forms;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class TheoremForm {
private String theoremName;
private String theorem;
}
@@ -0,0 +1,2 @@
spring.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp
+20
View File
@@ -0,0 +1,20 @@
<%@ page contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Theorem Entry</title>
</head>
<body>
<form method="post" action="">
<label>Theorem Name:
<input type="text" name="theoremName"/>
</label>
<br><label>Theorem:
<input type="text" name="theorem"/>
</label><br>
<input type="submit" value="Save">
</form>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
<html>
<body>
<br><b>Name: </b><%= request.getParameter("theoremName")%>
<br><b>Theorem: </b><%= request.getParameter("theorem")%>
</body>
</html>