我想用 Spring MVC 创建简单的导航,到目前为止我得到了这个:
@Controller
@RequestMapping("/secure")
public class NavigationController {
@ModelAttribute("myPath/operation")
public OperationForm getOperationForm() {
return new OperationForm();
}
@RequestMapping("/myPath/operation")
public String processOperationPage() {
//Some logic goes here
return "myPath/operation";
}
@ModelAttribute("myPath/configuration")
public ConfigurationForm getConfigurationForm() {
return new ConfigurationForm();
}
@RequestMapping("/myPath/configuration")
public String processConfigurationPage(Map model) {
return "myPath/configuration";
}
}
在我的 JSP 页面中:
<a href="${pageContext.servletContext.contextPath}/secure/myPath/configuration.htm" class="parent">Configuration</a>
<a href="${pageContext.servletContext.contextPath}/secure/myPath/operation.htm" class="parent">Operation</a>
这种浏览页面的解决方案是否有效?你能给我一些其他的导航方法吗?我确定有,但我在互联网上找不到任何东西。