こんにちは私はこのコントローラで有線の動作をしています。送信後の@RequestMapping(method = RequestMethod.POST)は、HTTPステータス405 - リクエストメソッド 'POST'を取得しました
コントローラー:
@Controller
public class NotificationController {
final String JSP_NOTIFICATION_01="pages/sendPush/createNotification";
final String JSP_NOTIFICATION_02="pages/sendPush/createNotificationStep2";
@RequestMapping(value ="/admin/notification/newNotification",method = RequestMethod.GET)
public String newNotification(Map<String, Object> model, HttpServletRequest request) {
//prepare info to fill html form
request.getSession().setAttribute("notificacion", notification);
return JSP_NOTIFICATION_01;
}
@RequestMapping(value ="/admin/notification/sendNotification", method = RequestMethod.POST)
public String saveNotification(@ModelAttribute("notForm") SendNotificationModel notForm,
Map<String, Object> model,HttpServletRequest request) {
//Get all information from HTML form
System.out.println("llego.."+resultado);
model.put("resultado", resultado);
return JSP_NOTIFICATION_02;
}
}
JSP
<form:form action="${pageContext.request.contextPath}/admin/notification/sendNotification" method="post" commandName="notForm">
<form:hidden path="clientName" />
<form:hidden path="clientCode" />
</tr>
<tr>
<td>topics:</td>
<td><form:select path="topics" items="${topicList}" /></td>
</tr>
<tr>
<td>users:</td>
<td><form:select multiple="true" path="users" items="${userList}" /></td>
</tr>
<tr>
<td>Tipo de despliege :</td>
<td><form:select path="tipoNotificacion" items="${tipoNotificacionList}" /></td>
</tr>
</table>
<tr>
<td colspan="2" align="center"><input type="submit" value="Enviar" /></td>
</tr>
</table>
</form:form>
後にPOSTメソッドを提出私は2つの方法がデ提出取得するには、HTMLフォームとPOSTで表示する情報を準備するには、Getしていますいつものようにリクエストを受け取りますが、リターンスプリングの後に405エラーが表示されます:
HTTP Status 405 - Request method 'POST' not supported
type Status report
message Request method 'POST' not supported
description The specified HTTP method is not allowed for the requested resource.
私はSpring 4.1.3とtomcat8を使用しています
ありがとうございました!!!
をリダイレクトを入れて、リファレンスhttp://howtodoinjava.com/spring/spring-mvc/spring-mvc-display-validate-and-submit-form-example/
を動作するにはどのような違いを生むでしょうか?あなたはPOSTメソッド – koutuk
@koutukに正確なパラメータを提供していることを確認してください間違ったパラメータが原因で405が発生するのはなぜですか? –