[opencms-dev] jstl redirect in module folder

Marc.Schlegel my.mailing.lists at gmx.de
Mon Aug 3 20:17:44 CEST 2009

Hello Everyone

I am developing a template with a login mechanism and for this I am
using the <c:redirect> tag from the JSTL.
When I had my login.jsp within the site-folder (/sites/mysite/en) the
redirects worked just fine. Then I moved the login.jsp to my template
folder to keep the actual site cleaner (moved to

After I did that, the redirect tags are ignored after I login/logout
method calls. So I moved the redirect to my bean using CmsRequestUtil
but thats just a workaround and troubles me sometimes.

<jsp:useBean id="cms" class="blubb.CmsRmsTemplateBean" >
    <% cms.init(pageContext, request, response); %>

    <c:when test="${(cms.loggedIn == false) && (param.action == 'login')}">
        <% cms.login(); %>
          <c:if test="${cms.loginSuccess}">
url="${cms:vfs(pageContext).link['/en/whatever.html']}"/> This is totaly
    <c:when test="${(cms.loggedIn == true) && (param.action == 'logout')}">
        <% cms.logout(); %>
        <c:redirect url="${cms:vfs(pageContext).link['/en/index.html']}"/>

<cms:include property="template" element="head" />

My login looks like this

    public void login(){
        String username = getRequest().getParameter(PARAM_USERNAME);
        String password = getRequest().getParameter(PARAM_PASSWORD);
        // loop through prefixes and try to login until it was
successfull (or not)
        for(String prefix : OU_PREFIX_ARRAY){
            login(prefix + username, password);
                getRequest().getSession().setAttribute("cms", this);
            // current redirects with CmsRequestUtl

I spent 1,5 days only on this...It kinda works but I am getting in
trouble when redirecting with different locales

Does anyone have an idea why this can be. As said before, when the page
was in the siteroot it worked fine.

best regards

More information about the opencms-dev mailing list