ZhipSoft.com
    冬去春来
        郑重声明:本Blog纯属个人学习、工作需要,记录相关资料。请不要发表任何有人身攻击的言论,谢谢!!www.ZhipSoft.com
posts - 94,comments - 149,trackbacks - 0

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

FeedBack:
# re: 针对不重新发送信息,则无法刷新网页。的终极解决方法
2009-04-02 22:42 | GSG
谢  回复  更多评论
  
# re: 针对不重新发送信息,则无法刷新网页。的终极解决方法[未登录]
2009-04-29 13:40 | David
好东西,谢了  回复  更多评论
  
# re: 针对不重新发送信息,则无法刷新网页。的终极解决方法
2010-02-03 10:00 |
上面的方法在页面中调用啦还是不能避免重新刷新的提示框  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: