连接 www.yj.com?name=yj&oid=xxxxx&sex=1
/**
* 把参数转存到model里 * * relPath * */ @SuppressWarnings({ "unchecked"}) public static void setParameters(HttpServletRequest request, ModelMap model) { Enumeration<String> parameterNames = request.getParameterNames(); if (parameterNames != null) { for (; parameterNames.hasMoreElements();) { String name = parameterNames.nextElement(); model.addAttribute(name, request.getParameter(name)); } } }使用案例
@RequestMapping(value = "/commAct/index.html", method = RequestMethod.GET)
public String index(HttpServletRequest request, HttpServletResponse response, ModelMap model) {//页面就可以根据参数名获取值了
WebSite.setParameters(request, model); return WebSite.getWebAppTemplate("commAct/index"); }
html
<input type='text' value=${name!}>