mardi 1 décembre 2015

How to redirect page to a url which is the same url as current with and additional parameter appended?

I wish to redirect my code to the same page with an extra parameter in the url if a few conditions are met. How would i do so?

I tried using response.setHeader but it is not not working.

if(request.getParameter("lang")==null && UserProfileHelper.readCookie(request,"bha_code")!=null){
            langCode=UserProfileHelper.readCookie(request,"bha_code");
            if(langCode!=null && langCode!="en")
            {
               String url=CafeUtils.getCurrentURLNonUFT8(request);
               String[] urlNew = url.split(fullLailaURL);
               url=fullLailaURL+"/"+langCode+urlNew[1];
               response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
               response.setHeader("Refresh", url);
            }
        }

I want the url in the browser to reflect the new one.

SC_MOVED_TEMPORARILY= 302




Aucun commentaire:

Enregistrer un commentaire