私はjspページを作成しました。そこからいくつかの値を取得し、送信時に、restを使用してパラメーターをJavaクラスに渡す必要があります。
<form id = "payment" method = "post" action = "addtogroup">
<ol style = "padding:0;">
<li> <labelfor = "groupId">グループID:</ label>
<input type = "text" id = "groupId" name = "groupId" />
<br />
<li> <labelfor = "vendorId">プロファイルID:</ label>
<input type = "text" id = "vendorId" name = "vendorId" />
<li> <input type = "submit" value = "Submit" /> <br /> </ ol>
</ form>
Javaコードは次のとおりです。
@RequestMapping(value = "/ addtogroup / {groupId} / {vendorId}"、method = RequestMethod.POST)
public String addtoGroup(@ModelAttribute("groupId") String groupId,@ModelAttribute("vendorId") String profileId){
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String username = auth.getName();
System.out.println("group id is="+groupId);
System.out.println("profileId is="+profileId);
System.out.println("username is="+username);
grpDao.addToGroup(groupId,profileId,username);
return "addtogroup";
}
アドレスバーに[http:// localhost:8080 / biznex / rest / addtogroup / 2/13]と直接入力すると、コードが実行されます。しかし、jspの送信ボタンをクリックすると、ページが見つかりませんというエラーが表示されます。plzは私を助けてくれます。