[opencms-dev] redirect from within template
Felix Sprick
felix.sprick at netlight.se
Wed Apr 25 09:56:20 CEST 2007
Hi,
I have trouble redirecting a request from within my template. I would like to
call another page that is located outside the CMS environment while passing the
parameters that the template page has received.
This is what I do:
Enumeration pNames = request.getParameterNames();
while (pNames.hasMoreElements())
{
String parameterName = pNames.nextElement().toString();
String paramValue = request.getParameter(parameterName);
paramValue = java.net.URLDecoder.decode(paramValue, codePage);
paramValue = java.net.URLEncoder.encode(paramValue,"UTF-8");
if (parameters.equals(""))
{
parameters = parameterName + "=" + paramValue;
}
else
{
parameters += "&" + parameterName + "=" + paramValue;
}
}
String destination = "http://myExternalPage.com/index.html?" + parameters ;
CmsRequestUtil.forwardRequest(destination , request,response)
What happens is that I get redirected to an empty page. I printed out the
string where it is supposed to redirect and it looks fine. There are no log
entries whatsoever. Any idea what I could have done wrong? Are there any other
ways to do redirects in the template?
/Felix
More information about the opencms-dev
mailing list