[opencms-dev] response.sendRedirect() - how to use in opencms

Roman Grom r.grom at web.de
Sun Sep 12 19:59:56 CEST 2004


Hello,

i want to detect the visitors browser locale and dependent to this 
redirect visitors to the adequate path.

I´ve this directory structure: ../public/de/index.html and 
../public/en/index.html and in the ../public/ folder
reside the "detector" jsp:

<%
String language = request.getHeader("Accept-Language");
if (language == "de")
{
  // redirect to de
  try{
    response.sendRedirect("/opencms/opencms/public/de/index.html");
  } catch (Exception ex) { out.println("DEBUG: Error while redirecting 
to /de/");}
}  
else
{
  // redirect to en
  try{
    response.sendRedirect("/opencms/opencms/public/de/index.html");
  } catch (Exception ex) { out.println("DEBUG: Error while redirecting 
to /en/");}
}
%>

But this act not as i expected.

Regardless i send to ../de/index.html or ../de/ result is a proper 
display of overall page described by my
template with not the content i redirectet to and (therefore?) no 
selectet menue item tied to the content.

The target url is good as far i can see them in my browser.

What next?

In awaiting your response and for recreation i turn back to lucene for now.

Many thanks!

Roman



More information about the opencms-dev mailing list