fixed again, thanks Alex for your detailed reviews I have learned alot :)

This commit is contained in:
-
2019-03-19 17:44:53 -06:00
parent f0cb7633c6
commit 5479130178
8 changed files with 35 additions and 71 deletions
@@ -1,16 +1,14 @@
package edu.msudenver.tsp.website.controller;
package edu.msudenver.tsp.website;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(final String[] args) {
public static void main(final String[] args)
{
SpringApplication.run(Application.class, args);
}
@@ -6,6 +6,8 @@ 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.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@@ -13,31 +15,20 @@ import org.springframework.web.servlet.ModelAndView;
@Slf4j
@Controller
@AllArgsConstructor
@RequestMapping("/theorem")
public class TheoremEntryController {
@RequestMapping("/theorem")
public ModelAndView theoremPage()
@GetMapping({"/",""})
public ModelAndView enterTheoremPage()
{
return new ModelAndView("Theorem");
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
@PostMapping({"/",""})
public String saveTheorem(@Validated Theorem theorem, Model model) {
model.addAttribute("theromName", theorem.getTheoremName());
model.addAttribute("theromName1", theorem.getTheoremName1());
model.addAttribute("theromName2", theorem.getTheoremName2());
return "success";
}
public ModelAndView firstPage() {
return new ModelAndView("welcome");
}
}
}
@@ -3,23 +3,14 @@ package edu.msudenver.tsp.website.controller.forms;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
@Getter
@Setter
public class Theorem {
private String theoremName ;
public String getTheoremName() {
return theoremName;
}
public void setTheoremName1(String theoremName) {
this.theoremName = theoremName;
}
private String theoremName1 ;
private String theoremName2 ;
@NotBlank(message = "Theorem name must not be blank") private String theoremName;
private String theorem;
}