如何根据条件if和else从liferay的jsp页面重定向到特定url?

如何根据条件if和else从liferay的jsp页面重定向到特定url?,jsp,redirect,liferay,portlet,liferay-6,Jsp,Redirect,Liferay,Portlet,Liferay 6,我已经覆盖了liferay的login.jsp文件 <%-- /** * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published

我已经覆盖了liferay的login.jsp文件

<%--
/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
--%>

<%@ include file="/html/portlet/login/init.jsp" %>
<link rel="stylesheet" href="/html/portlet/login/css/bootstrap.min.css" />
<link rel="stylesheet" href="/html/portlet/login/css/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="/html/portlet/login/css/blue.css" />
<link rel="stylesheet" href="/html/portlet/login/css/custom.css" />
<link rel="stylesheet" href="/html/portlet/login/css/jquery.qtip.min.css" />
<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>

<c:choose>
    <c:when test="<%= themeDisplay.isSignedIn() %>">

        <%
        String signedInAs = HtmlUtil.escape(user.getFullName());

        if (themeDisplay.isShowMyAccountIcon()) {
            signedInAs = "<a href=\"" + HtmlUtil.escape(themeDisplay.getURLMyAccount().toString()) + "\">" + signedInAs + "</a>";
        }
        %>
        <%= LanguageUtil.format(pageContext, "you-are-signed-in-as-x", signedInAs, false) %>
    </c:when>
    <c:otherwise>
        <%
        String redirect = ParamUtil.getString(request, "redirect");

        String login = LoginUtil.getLogin(request, "login", company);
        String password = StringPool.BLANK;
        boolean rememberMe = ParamUtil.getBoolean(request, "rememberMe");

        if (Validator.isNull(authType)) {
            authType = company.getAuthType();
        }
        %>

        <portlet:actionURL secure="<%= PropsValues.COMPANY_SECURITY_AUTH_REQUIRES_HTTPS || request.isSecure() %>" var="loginURL">
            <portlet:param name="saveLastPath" value="0" />
            <portlet:param name="struts_action" value="/login/login" />
            <portlet:param name="doActionAfterLogin" value="<%= portletName.equals(PortletKeys.FAST_LOGIN) ? Boolean.TRUE.toString() : Boolean.FALSE.toString() %>" />
        </portlet:actionURL>

        <aui:form action="<%= loginURL %>" autocomplete='<%= PropsValues.COMPANY_SECURITY_LOGIN_FORM_AUTOCOMPLETE ? "on" : "off" %>' method="post" name="fm">
            <aui:input name="redirect" type="hidden" value="<%= redirect %>" />

            <c:choose>
                <c:when test='<%= SessionMessages.contains(request, "user_added") %>'>

                    <%
                    String userEmailAddress = (String)SessionMessages.get(request, "user_added");
                    String userPassword = (String)SessionMessages.get(request, "user_added_password");
                    %>
                    <div class="portlet-msg-success">
                        <c:choose>
                            <c:when test="<%= company.isStrangersVerify() || Validator.isNull(userPassword) %>">
                                <%= LanguageUtil.get(pageContext, "thank-you-for-creating-an-account") %>

                                <c:if test="<%= company.isStrangersVerify() %>">
                                    <%= LanguageUtil.format(pageContext, "your-email-verification-code-has-been-sent-to-x", userEmailAddress) %>
                                </c:if>
                            </c:when>
                            <c:otherwise>
                                <%= LanguageUtil.format(pageContext, "thank-you-for-creating-an-account.-your-password-is-x", userPassword, false) %>
                            </c:otherwise>
                        </c:choose>

                        <c:if test="<%= PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.ADMIN_EMAIL_USER_ADDED_ENABLED) %>">
                            <%= LanguageUtil.format(pageContext, "your-password-has-been-sent-to-x", userEmailAddress) %>
                        </c:if>
                    </div>
                </c:when>
                <c:when test='<%= SessionMessages.contains(request, "user_pending") %>'>

                    <%
                    String userEmailAddress = (String)SessionMessages.get(request, "user_pending");
                    %>

                    <div class="portlet-msg-success">
                        <%= LanguageUtil.format(pageContext, "thank-you-for-creating-an-account.-you-will-be-notified-via-email-at-x-when-your-account-has-been-approved", userEmailAddress) %>
                    </div>
                </c:when>
            </c:choose>

            <liferay-ui:error exception="<%= AuthException.class %>" message="authentication-failed" />
            <liferay-ui:error exception="<%= CompanyMaxUsersException.class %>" message="unable-to-login-because-the-maximum-number-of-users-has-been-reached" />
            <liferay-ui:error exception="<%= CookieNotSupportedException.class %>" message="authentication-failed-please-enable-browser-cookies" />
            <liferay-ui:error exception="<%= NoSuchUserException.class %>" message="authentication-failed" />
            <liferay-ui:error exception="<%= PasswordExpiredException.class %>" message="your-password-has-expired" />
            <liferay-ui:error exception="<%= UserEmailAddressException.class %>" message="authentication-failed" />
            <liferay-ui:error exception="<%= UserLockoutException.class %>" message="this-account-has-been-locked" />
            <liferay-ui:error exception="<%= UserPasswordException.class %>" message="authentication-failed" />
            <liferay-ui:error exception="<%= UserScreenNameException.class %>" message="authentication-failed" />

            <aui:fieldset>

                <%
                String loginLabel = null;
                if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) {
                    loginLabel = "";
                }
                else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
                    loginLabel = "screen-name";
                }
                else if (authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
                    loginLabel = "id";
                }
                %>                      
                <span id="<portlet:namespace />passwordCapsLockSpan" style="display: none;"><liferay-ui:message key="caps-lock-is-on" /></span>

                <div class="login_page">
                    <div class="login_box">     
                        <form id="login_form">
                            <div class="top_b">Sign in</div>    
                            <div class="alert alert-info alert-login">
                                Login with your Username and Password
                            </div>
                            <div class="cnt_b">
                                <div class="formRow">
                                    <div class="input-prepend">
                                        <span style="float:left;" class="add-on"><i class="icon-user"></i></span>
                                        <aui:input label="" style="width:210px;" name="login" showRequiredLabel="<%= false %>" type="text" value="">                                
                                        </aui:input>
                                    </div>
                                </div>
                                <div class="formRow">
                                    <div class="input-prepend">
                                        <span style="float:left;" class="add-on"><i class="icon-lock"></i></span>
                                        <aui:input label="" style="width:210px;" name="password" showRequiredLabel="<%= false %>" type="password" value="<%= password %>">                              
                                        </aui:input>
                                    </div>
                                </div>
                                <div class="formRow clearfix" style='margin-top:0;'>
                                    <c:if test="<%= company.isAutoLogin() && !PropsValues.SESSION_DISABLED %>">
                                        <label class="checkbox"><input type="checkbox" checked="<%= rememberMe %>" name="rememberMe"/> Remember me</label>
                                    </c:if>                     
                                </div>
                            </div>
                            <div class="btm_b clearfix">                                    
                                <aui:button-row>

                                    <aui:button style="float:right;" class="btn btn-inverse pull-right" type="submit" value="sign-in" />                                    
                                </aui:button-row>                                                   
                            </div>  
                        </form>                 
                    </div>      
                </div>          
            </aui:fieldset>         
        </aui:form>                         
        <c:if test="<%= windowState.equals(WindowState.MAXIMIZED) %>">
            <aui:script>
                Liferay.Util.focusFormField(document.<portlet:namespace />fm.<portlet:namespace />login);
            </aui:script>
        </c:if>

        <aui:script use="aui-base">
            var password = A.one('#<portlet:namespace />password');
            if (password) {
                password.on(
                    'keypress',
                    function(event) {
                        Liferay.Util.showCapsLock(event, '<portlet:namespace />passwordCapsLockSpan');
                    }
                );
            }
        </aui:script>
    </c:otherwise>
</c:choose>

登录
使用您的用户名和密码登录
记得我吗
Liferay.Util.focusFormField(document.fm.login);
var password=A.one(“#password”);
如果(密码){
密码(
“按键”,
功能(事件){
Liferay.Util.showCapsLock(事件'passwordCapsLockSpan');
}
);
}
上面是我的login.jsp,我现在面临的问题是当我过去删除历史记录,然后当我刷新页面时,它只给我一个标签“yoursigningas”:用户名


但是我怎样才能防止这种情况发生呢?当用户清除历史记录时,它应该被重定向到登录页面,而不是现在的这个页面……我不想知道如何从jsp页面本身重定向到c/portal/login url?

你能检查一下在ROOT.war/WEB-INF/WEB.xml中,您有
自动登录过滤器
条目和
url模式
/c/portal/Login
?表单PortalRealm/c/portal/j_login/c/portal/j_login_error.。这是我在我的web.xml中得到的。除此之外,我还有这个条目。。。
Auto Login Filter/c/portal/Login REQUEST FORWARD
Auto Login Filter com.liferay.portal.servlet.filters.autologin.AutoLoginFilter
所以我需要在我的web.xml中添加这几行。这几行可以做什么…你能解释一下吗?