diff --git a/src/main/java/ru/ulstu/fc/rule/controller/RuleController.java b/src/main/java/ru/ulstu/fc/rule/controller/RuleController.java index 9dcd845..788568c 100644 --- a/src/main/java/ru/ulstu/fc/rule/controller/RuleController.java +++ b/src/main/java/ru/ulstu/fc/rule/controller/RuleController.java @@ -6,6 +6,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import ru.ulstu.fc.rule.model.AddRuleForm; +import ru.ulstu.fc.rule.model.AddTermForm; import ru.ulstu.fc.rule.service.RuleParseService; import java.util.List; @@ -34,4 +35,16 @@ public class RuleController { model.addAttribute("addRuleForm", addRuleForm); return "listRules"; } + + @GetMapping("addTerm") + public String addTerm(Model model) { + model.addAttribute("addTermForm", new AddTermForm()); + return "addTerm"; + } + + @PostMapping("addTerm") + public String parse(@ModelAttribute AddTermForm addTermForm, Model model) { + model.addAttribute("addTermForm", addTermForm); + return "listTerms"; + } } diff --git a/src/main/java/ru/ulstu/fc/rule/model/AddTermForm.java b/src/main/java/ru/ulstu/fc/rule/model/AddTermForm.java new file mode 100644 index 0000000..28924d5 --- /dev/null +++ b/src/main/java/ru/ulstu/fc/rule/model/AddTermForm.java @@ -0,0 +1,40 @@ +package ru.ulstu.fc.rule.model; + +public class AddTermForm { + private String variable; + private String term; + private String min; + private String max; + + public String getVariable() { + return variable; + } + + public void setVariable(String variable) { + this.variable = variable; + } + + public String getTerm() { + return term; + } + + public void setTerm(String term) { + this.term = term; + } + + public String getMin() { + return min; + } + + public void setMin(String min) { + this.min = min; + } + + public String getMax() { + return max; + } + + public void setMax(String max) { + this.max = max; + } +} diff --git a/src/main/resources/templates/addTerm.html b/src/main/resources/templates/addTerm.html new file mode 100644 index 0000000..bd131f7 --- /dev/null +++ b/src/main/resources/templates/addTerm.html @@ -0,0 +1,41 @@ + + +
+