我需要在Spring代码中处理这个Struts代码String navigatedFrom = mapping.getParameter();
public class foo extends abcAction {
private static final String TAKEA = "HAi";
private static final String OTHERO = "otherOptions";
private static final String TAKINGA = "taking";
@RequestMapping()
public ModelAndView processDefault(
ModelMap model, HttpServletRequest request,
HttpServletResponse response) throws ServletException,SystemException {
String navigatedFrom = mapping.getParameter();
//some condtions
}
}
如何在春季mapping.get
中处理mapping.getparameter()
参数?
答案 0 :(得分:0)
在处理Struts请求时创建映射。您在Spring中无需做任何事情,而不是提供自己的@RequestMapping
。
如果您需要了解有关如何在Spring中提供请求映射的更多信息,请阅读Serving Web Content with Spring MVC。
@Controller public class GreetingController { @RequestMapping("/greeting") public String greeting(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) { model.addAttribute("name", name); return "greeting"; }
此代码清楚地向您展示了如何在请求映射中使用属性。