配置视图解析器:
<!-- 2.内部资源视图解析器 -->
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages"></property>
<property name="suffix" value=""></property>
</bean>
代码:
@RequestMapping("/login/studentlogin.action")
public String studentlogin(Integer username,String password){
System.out.println("接收到数据:"+username+"---"+password);
Map map = new HashMap();
map.put("id", username);
map.put("password", password);
List<Student> students = this.studentService.findStudent(map);
if(students.size()==1){
System.out.println("密码正确");
return "redirect:/showcourse/toshowcourse.action";
}else{
System.out.println("密码错误");
return "";
}
}
我想密码错误的时候,重新返回到根目录下的页面上去,但是因为在视图中已经将所有的请求放入WEB-INF下面去了,不知道怎么写才返回到根目录下,各位大神解答下?