PAN-16 finished

This commit is contained in:
-
2019-03-14 16:58:17 -06:00
parent 2dda30753e
commit 139dc943c3
16 changed files with 275 additions and 327 deletions
@@ -1,23 +1,21 @@
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
//import lombok.extern.slf4j.Slf4j;
@SpringBootApplication
public class Application {
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}
}
@Bean
/*@Bean
public CommandLineRunner commandLineRunner(final ApplicationContext ctx) {
return args -> {
@@ -28,6 +26,9 @@ public class Application {
for (final String beanName : beanNames) {
LOG.info(beanName);
}
};
}
}
}
*/
@@ -1,4 +1,5 @@
package edu.msudenver.tsp.website;
public class ProofsDriver {
//Business Logic will go here
}
@@ -0,0 +1,43 @@
package edu.msudenver.tsp.website;
import edu.msudenver.tsp.website.forms.Theorem;
import edu.msudenver.tsp.website.service.ProofDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class TheoremEntryController {
@Autowired
ProofDriver proofDriver;
@RequestMapping("/welcome")
public ModelAndView firstPage()
{
return new ModelAndView("welcome");
}
@RequestMapping("/theorem")
public ModelAndView theoremPage()
{
return new ModelAndView("Theorem");
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
public String saveTheorem(@Validated Theorem theorem, Model model) {
proofDriver.processProof(theorem.getTheoremName());
model.addAttribute("theromName", theorem.getTheoremName());
return "success";
}
}
@@ -0,0 +1,19 @@
package edu.msudenver.tsp.website.forms;
public class Theorem {
private String theoremName ;
public String getTheoremName() {
return theoremName;
}
public void setTheoremName(String theoremName) {
this.theoremName = theoremName;
}
}
@@ -0,0 +1,16 @@
package edu.msudenver.tsp.website.service;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class ProofDriver {
List<String> theromList = new ArrayList<String>();
public String processProof(String theoremName){
//Business Logic
return theoremName + "Accepted";
}
}
@@ -0,0 +1,2 @@
spring.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp
+15
View File
@@ -0,0 +1,15 @@
<%@ page language="java" 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>Theroem Page</title>
</head>
<body>
<form action="save" method="post">
Enter Theroem Name <input type="text" name="theoremName"><br>
<input type="submit" value="save">
</form>
</body>
</html>
+6
View File
@@ -0,0 +1,6 @@
<html>
<body>
<b>Name:</b><%= request.getParameter("theoremName")%>
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Guru Success Page</title>
</head>
<body>
<a><b>Welcome User!!!!</b></a>
</body>
</html>
-16
View File
@@ -1,16 +0,0 @@
<%--
Created by IntelliJ IDEA.
User: atusa
Date: 2/1/19
Time: 8:03 PM
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>$Title$</title>
</head>
<body>
$END$
</body>
</html>