开发者

JSF commandButton action returns proper value, but navigation rule doesn't apply

开发者 https://www.devze.com 2023-01-29 05:55 出处:网络
Title pretty much says it all. I have a page called login.jsp: <f:view> <html> <head> <meta http-equiv=\"Content-Type\"

Title pretty much says it all. I have a page called login.jsp:

<f:view>
  <html>
    <head>
      <meta http-equiv="Content-Type"
            content="text/html; charset=windows-1250"/>
      <title>Bejelentkezés</title>
      <!--<script language="JavaScript" src="login.js" type="text/javascript"></script>-->
    </head>
    <body>
      <h:form>
        <h:messages/>
        <p>
          Ur&aacute;n Tanulm&aacute;nyi Rendszer
        </p>
        <p>
          Login: <h:inputText binding="#{backing_admin.loginLoginInput}"
                       id="loginLoginInput"/>
        </p>
        <p>
          Jelsz&oacute;: <h:inputSecret binding="#{backing_admin.loginPasswordInput}"
                                       id="loginPasswordInput"/>
        </p>
        <p>
          <h:commandButton value="Bejelentkezés"
                           binding="#{backing_admin.loginLoginButton}"
                           id="loginLoginButton"
                           action="#{backing_admin.loginAction}"/>
        </p>
      </h:form>
    </body>
  </html>
</f:view>
<%-- oracle-jdev-comment:auto-binding-backing-bean-name:backing_admin--%>

And some navigation rules:

<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
  <managed-bean>
    <managed-bean-name>backing_admin</managed-bean-name>
    <managed-bean-class>hu.elte.pgy2.BACNAAI.view.backing.BackingAdmin</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1admin.jsp-->
    <!--oracle-jdev-comment:managed-bean-jsp-link:1login.jsp-->
  </managed-bean>
  <navigation-rule>
    <from-view-id>/login.jsp</from-view-id>
    <navigation-case>
      <from-action>#{backing_adm开发者_运维百科in.loginAction}</from-action>
      <from-outcome>"ADMIN"</from-outcome>
      <to-view-id>/admin.jsp</to-view-id>
      <redirect/>
    </navigation-case>
    <navigation-case>
      <from-action>#{backing_admin.loginAction}</from-action>
      <from-outcome>"STUDENT"</from-outcome>
      <to-view-id>/student.jsp</to-view-id>
      <redirect/>
    </navigation-case>
  </navigation-rule>
</faces-config>

Clicking the button on login.jsp invokes the action in the backing bean, which returns the value it's supposed to, but I get redirected back to login.jsp instead of the page defined in the navigation rule. What could cause this to happen?


replace "ADMIN" with ADMIN "STUDENTS" with STUDENTS

remove " in navigation case

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号