<html:link page="/order.do?action=detail&" paramId="orderid" paramName="order" paramProperty="id"><bean:write name="order" property="id" /></html:link

解决方案 »

  1.   

    /**
     * complete the overridder method and redirect the URL if need
     * else forward request to the next filter
     */
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException 
      {
      if (request instanceof HttpServletRequest) {
     
      StringBuffer requstURL = ((HttpServletRequest) request).getRequestURL();
      String url = requstURL.toString();
      int index = url.indexOf(userDir);
      
      if(hashMap.containsKey(url.substring(url.lastIndexOf(".") + 1)) && index > 0){
      
      //construct the URL
      String redirectURL = "http://" + request.getServerName() + ":" + request.getServerPort()
       + baseDir + actionPath;
      String tempStr = url.substring(url.lastIndexOf("/") + 1);
      int splitIndex = tempStr.indexOf(".");
      String nodeId = tempStr.substring(0,splitIndex);
      redirectURL = redirectURL + "?nodeId=" + nodeId;
      
      //redirect the URL
      if(response instanceof HttpServletResponse){
      ((HttpServletResponse) response).sendRedirect(redirectURL);
      }
      
      }else if(index > 0){
      
      //construct the URL
      String redirectURL = "http://" + request.getServerName() + ":" + request.getServerPort()
    + baseDir + actionPath;
      String tempStr = url.substring(url.lastIndexOf("/") + 1);
      int splitIndex = tempStr.indexOf(".");
      String nameId = tempStr.substring(0,splitIndex);
      redirectURL = redirectURL + "?param1=" + nameId;
      
      //redirect the URL
      if(response instanceof HttpServletResponse){
      ((HttpServletResponse) response).sendRedirect(redirectURL);
      }
      
      }else{
      chain.doFilter(request, response);
      }
      }
      }