我正在尝试在请求映射中使用正则表达式,但似乎服务器看不到映射:
@RequestMapping( value = "/index/{postPath:^(?:mock_test[1-5]|reviewer_test(?:[145]|3[.][12]))$}", method = RequestMethod.POST )
public String evaluateExam( @PathVariable
String postPath, @ModelAttribute( "wrapper" )
QuestionnaireBeanWrapper wrapper, HttpServletRequest request )
{
//evaluateExam( wrapper, "Reviewer V" );
EvaluationUnit evaluationUnit = new EvaluationUnit();
try
{
List<String> answersList = new QuestionnaireDAO().getAnswerList( "Reviewer V" );
StudentBean studentBean = evaluationUnit.executeEvaluation( wrapper, answersList );
System.out.println( studentBean.getKnowledgeLevel() );
}
catch( Exception e )
{
// no logger yet
e.printStackTrace();
}
return "redirect:../index/mock.do";
}
我的表单网址:
<form:form id="reading-form" action="../index/reviewer_test5.do" method="POST" modelAttribute="wrapper">
...
</form:form>
我测试了正则表达式here,它非常好。
关于我的URL的.do
后缀,它是在我的servlet配置中定义的,我确信它正在运行,因为我已经使用它一个月了。
此外,如果这也是相关的,我的get
映射也与帖子相同:
@RequestMapping( value = "/index/reviewer_test5", method = RequestMethod.GET )