这是我的第一个Web应用程序,我正在尝试使用spring mvc构建它。但是,当我尝试重定向页面时,我经常遇到css不能经常应用。
我有一个像这样的控制器
@RequestMapping(value="/budget", method=RequestMethod.GET )
public String showBudgetPage() {
LOGGER.info("Show Budget Page"); // Display budget page.
int year = Calendar.getInstance().get(Calendar.YEAR);
return "budget";
}
该页面将使用css进行样式设置。但是,当我尝试使用以下内容重定向页面时
@RequestMapping(value="/budget", method=RequestMethod.GET )
public String showBudgetPage() {
LOGGER.info("Show Budget Page"); // Display budget page.
int year = Calendar.getInstance().get(Calendar.YEAR);
return "redirect:/" + String.valueOf(year) + "/budget";
//return "redirect:" + String.valueOf(year) + "/budget";
}
@RequestMapping(value="/{year}/budget", method=RequestMethod.GET)
public String showBudgetPageByYear(Model model,
@PathVariable("year") int year) {
LOGGER.info("Show Budget Page");
return "budget";
}
页面完全返回原始状态,白色背景和黑色正面。愿任何人建议我为什么会这样吗?我将来如何防止它和类似的情况?非常感谢。