SpringMVC 路径访问问题
@Controller@RequestMapping("/controller/infoManageDetailed")publicclassInfoManageDeta...
@Controller
@RequestMapping("/controller/infoManageDetailed")
public class InfoManageDetailedController{
@RequestMapping(value="/getTest",method=RequestMethod.GET)
public String getTest(Model model){
return "/infoManage/infoManageDetailed";
}
}
访问:localhost:8080/Code/controller/infoManageDetailed/getTest
报错404:Code/controller/infoManageDetailed/resource/infoManage/infoManageDetailed.jsp 展开
@RequestMapping("/controller/infoManageDetailed")
public class InfoManageDetailedController{
@RequestMapping(value="/getTest",method=RequestMethod.GET)
public String getTest(Model model){
return "/infoManage/infoManageDetailed";
}
}
访问:localhost:8080/Code/controller/infoManageDetailed/getTest
报错404:Code/controller/infoManageDetailed/resource/infoManage/infoManageDetailed.jsp 展开
1个回答
展开全部
没有配置jsp视图的地址。
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/pages/" />
<property name="suffix" value=".jsp"></property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/pages/" />
<property name="suffix" value=".jsp"></property>
</bean>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询