消息:此URL不支持HTTP方法POST [英] message: HTTP method POST is not supported by this URL
本文介绍了消息:此URL不支持HTTP方法POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在有人试图将此标记为重复或由于缺乏研究而标记之前我承认这个问题已经存在于堆栈溢出但是提供的解决方案无法解决我的问题所以我想看看人们是否可以解决这个独特的问题我正在体验。
Before anyone tries to mark this as duplicated or mark down because of a lack of research I acknowledge this question already exists on stack overflow but the offered solutions do not solve my problem so I wanted to see if people could solve this unique problem I am experiencing.
这是我的表格
<form:form method="POST" action="addQuestion" >
<input type="text" name="questionId" />Enter Id<br>
<input type="text" name="theQuestion" />Enter Q <br>
<input type="text" name="category" />Enter Category<br>
<input type="text" name="correctAnswer" />Enter correct answer<br>
<input type="submit" value="Next" >
</form:form>
这会出现在我的web.xml中
and this appears in my web.xml
<servlet>
<servlet-name>addQ</servlet-name>
<servlet-class>main.WebController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>addQ</servlet-name>
<url-pattern>/addQuestion</url-pattern>
</servlet-mapping>
这是我的webcontroller
and this is my webcontroller
@RequestMapping("/addQuestion")
public String addQuestion(ModelMap model, @RequestParam(value="question", required = true) String theQuestion , @RequestParam(value="questionId", required = true) Integer questionId, @RequestParam(value="category", required = true) String category, @RequestParam(value="correctAnswer", required = true) String correctAnswer) throws SQLException{
ViewController viewController = new ViewController();
viewController.createQuestion(questionId, theQuestion, category, correctAnswer);
model.addAttribute("message", "Hello hope this flipping works");
return "addQuestion";
}
我收到的错误消息是HTTP方法POST不支持网址
and the error message I am getting is HTTP method POST is not supported by this URL
推荐答案
执行此操作:
@RequestMapping(value =/ addQuestion,method = RequestMethod.POST)
这篇关于消息:此URL不支持HTTP方法POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文