[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
/system/modules/mymodule/pages/login.jsp).

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); %>
</jsp:useBean>

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

<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);
            if(isLoginSuccess()){
                getRequest().getSession().setAttribute("cms", this);
                break;
            }
        }
        if(isLoginSuccess())
        {
            // 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
Marc



More information about the opencms-dev mailing list