grails
2014-06-20 41 views 0 likes 
0

我需要知道以下內容。我從auth.gsp複製了以下代碼。我需要知道什麼:在auth.gsp中找到的URL - 初學者

1.)我需要知道'$ {postUrl}'是什麼意思?

2.)我沒有複製這段代碼並將其粘貼到另一個名爲index.gsp的GSP中,但該頁未成功登錄。

<form action='${postUrl}' method='POST' id="loginForm" name="loginForm" autocomplete='off'> 
    <div class="sign-in"> 

    <h1><g:message code='spring.security.ui.login.signin'/></h1> 

    <table> 
     <tr> 
      <td><label for="username"><g:message code='spring.security.ui.login.username'/></label></td> 
      <td><input name="j_username" id="username" size="20" /></td> 
     </tr> 
     <tr> 
      <td><label for="password"><g:message code='spring.security.ui.login.password'/></label></td> 
      <td><input type="password" name="j_password" id="password" size="20" /></td> 
     </tr> 
     <tr> 
      <td colspan='2'> 
       <input type="checkbox" class="checkbox" name="${rememberMeParameter}" id="remember_me" checked="checked" /> 
       <label for='remember_me'><g:message code='spring.security.ui.login.rememberme'/></label> | 
       <span class="forgot-link"> 
        <g:link controller='register' action='forgotPassword'><g:message code='spring.security.ui.login.forgotPassword'/></g:link> 
       </span> 
      </td> 
     </tr> 
     <tr> 
      <td colspan='2'> 
       <s2ui:linkButton elementId='register' controller='register' messageCode='spring.security.ui.login.register'/> 
       <s2ui:submitButton elementId='loginButton' form='loginForm' messageCode='spring.security.ui.login.login'/> 
      </td> 
     </tr> 
    </table> 

    </div> 
    </form> 

回答

0

春季安全工作的過濾器。如果您在gsp文件中輸入postUrl,那麼它看起來像/myApp/j_spring_security_check,只有/j_spring_security_check URL由Spring Security過濾器處理。

如果你過去auth.gap而不發送這個URL然後無法登錄。稍微改變你的gsp使其運行,用${createLink(uri: '/j_spring_security_check')}代替${postUrl}

相關問題