JAVA:
public class UtilTool {
public static Map getParameterMap(HttpServletRequest request) {
Map paramMap = new LinkedHashMap();
String pathInfoStr = request.getPathInfo();
if (pathInfoStr != null && pathInfoStr.length() > 0) {
if (!pathInfoStr.endsWith("/")) pathInfoStr += "/";
int current = pathInfoStr.indexOf('/');
int last = current;
while ((current = pathInfoStr.indexOf('/', last + 1)) != -1) {
String element = pathInfoStr.substring(last + 1, current);
last = current;
if (element.charAt(0) == '~' && element.indexOf('=') > -1) {
String name = element.substring(1, element.indexOf('='));
String value = element.substring(element.indexOf('=') + 1);
paramMap.put(name, value);
}
}
}
java.util.Enumeration e = request.getParameterNames();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
paramMap.put(name, request.getParameter(name));
}
if (paramMap.size() == 0) {
Map multiPartMap = (Map) request.getAttribute("multiPartMap");
if (multiPartMap != null && multiPartMap.size() > 0) {
paramMap.putAll(multiPartMap);
}
}
return paramMap;
}
public static String requestParameter(HttpServletRequest request){
String fromstr="<form name='request' method='POST'>";
Enumeration requestKeys = request.getParameterNames();
Map requestValues=UtilTool.getParameterMap(request);
String rkey = null;
for(;requestKeys.hasMoreElements();){
rkey = (String) requestKeys.nextElement();
fromstr+="<input name='"+rkey+"' value='"+requestValues.get(rkey)+"' type='hidden'>";
}
fromstr+="</form><script>function reload(){request.submit()}</script>";
return fromstr;
}
}
Jsp调用:
<%=UtilTool.requestParameter(request)%>
这样当需要调用弹出窗口并刷新当前页时如:
针对当前页的刷新
window.location.reload();
改为
reload();
本Blog纯属个人学习、工作需要,记录相关资料。请不要发表任何有人身攻击的言论,谢谢! www.zhipsoft.cn
posted on 2008-09-25 16:53
ZhipSoft 阅读(4067)
评论(3) 编辑 收藏 所属分类:
Java