@RestController
@RequestMapping(value="addPerson", method=RequestMethod.GET)
public String addPerson(@RequestParam(value="name", required=false) String Fname, @RequestParam(value="pwd", required=false) String Lname){
Person person= new Person(Fname,Lname);
crudService.addPerson(person);
return "Successfully added " + Fname;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body bgcolor="yellow">
<form action="addPerson" method="get"></form>
<table>
<tr>
<td>Enter Your Name</td>
<td>
<input type="text" name="name">
</td>
</tr>
<tr>
<td>Enter Password</td>
<td>
<input type="password" name="pwd">
</td>
</tr>
<tr>
<td>
<input type="submit" value="SUBMIT">
</td>
</tr>
</table>
</body>
</html>
HTMLファイルを内部に配置しましたが、ビューの代わりに文字列を返すだけのsrc/main/resources/static/NewFile.html
ようにコントローラーを使用すると機能しません.それにアクセスするために与えていることに加えて、動的な値を入力して送信しても機能しません特定のコントローラーに移動します。(@RequestMapping("/"))
http://localhost:80/NewFile.html
私はこれが初めてですSpringboot
。どこが間違っているのか教えてください。