0

嗨,我正在尝试使用 oracle jdeveloper使用 j2ee 开发我的第一个应用程序,我想通过单击登录按钮重定向jsf 页面!这是我在 sessionBean 中的函数


 public String authentification(String login, String pwd) {

        try{
            Query query;
            query = em.createQuery("select o from UserEntity o where " + " o.login = :LOGIN AND o.pwd = :PWD");
            query.setParameter("LOGIN",login);
            query.setParameter("PWD",pwd);

         UserEntity ue = (UserEntity) query.getSingleResult();

                return"/untitled2?faces-redirect=true";


        }catch(Exception e){
            return "/untitled3?faces-redirect=true";
        }

    }

这是我在 jsf 页面中的按钮

<af:button actionListener="#{bindings.authentification.execute}" text="authentification"
                                       disabled="#{!bindings.authentification.enabled}" id="b1"/>

我的 faces-config 会像

<faces-config version="2.1" xmlns="http://java.sun.com/xml/ns/javaee">
  <application>
    <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
  </application>
  <navigation-rule>
    <from-view-id>/untitled1.jsf</from-view-id>
    <navigation-case>
      <from-outcome>success</from-outcome>
      <to-view-id>/untitled2.jsf</to-view-id>
      <redirect/>
    </navigation-case>
    <navigation-case>
      <from-outcome>fail</from-outcome>
      <to-view-id>/untitled3.jsf</to-view-id>
    </navigation-case>
  </navigation-rule>
</faces-config>

这是我的 untitled2.jsf

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html>
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <af:document title="untitled2.jsf" id="d1">
        <af:messages id="m1"/>
        <af:form id="f1">
            <af:panelGridLayout id="pgl1">
                <af:gridRow height="50px" id="gr3">
                    <af:gridCell width="auto" halign="stretch" valign="stretch" id="gc3">
                        <!-- Header -->
                    </af:gridCell>
                </af:gridRow>
                <af:gridRow height="100%" id="gr1">
                    <af:gridCell width="auto" halign="stretch" valign="stretch" id="gc2">
                        <!-- Content -->
                        <af:panelFormLayout id="pfl1">
                            <af:panelFormLayout id="pfl2"
                                                inlineStyle="background-color:transparent; width:752px; height:193px;">
                                <af:inputText value="#{bindings.id.inputValue}" label="#{bindings.id.hints.label}"
                                              required="#{bindings.id.hints.mandatory}"
                                              columns="#{bindings.id.hints.displayWidth}"
                                              maximumLength="#{bindings.id.hints.precision}"
                                              shortDesc="#{bindings.id.hints.tooltip}" id="it1">
                                    <f:validator binding="#{bindings.id.validator}"/>
                                    <af:convertNumber groupingUsed="false" pattern="#{bindings.id.format}"/>
                                </af:inputText>
                                <af:inputText value="#{bindings.pwd.inputValue}" label="#{bindings.pwd.hints.label}"
                                              required="#{bindings.pwd.hints.mandatory}"
                                              columns="#{bindings.pwd.hints.displayWidth}"
                                              maximumLength="#{bindings.pwd.hints.precision}"
                                              shortDesc="#{bindings.pwd.hints.tooltip}" id="it2">
                                    <f:validator binding="#{bindings.pwd.validator}"/>
                                </af:inputText>
                                <af:inputText value="#{bindings.login.inputValue}" label="#{bindings.login.hints.label}"
                                              required="#{bindings.login.hints.mandatory}"
                                              columns="#{bindings.login.hints.displayWidth}"
                                              maximumLength="#{bindings.login.hints.precision}"
                                              shortDesc="#{bindings.login.hints.tooltip}" id="it3">
                                    <f:validator binding="#{bindings.login.validator}"/>
                                </af:inputText>
                                <af:button actionListener="#{bindings.persistUserEntity.execute}"
                                           text="persistUser" disabled="#{!bindings.persistUserEntity.enabled}"
                                           id="b4"/>
                                <af:button actionListener="#{bindings.Delete.execute}" text="Delete"
                                           disabled="#{!bindings.Delete.enabled}" id="b3"/>
                                <af:button text="Submit" id="b1"/>
                                <f:facet name="footer">
                                    <af:button actionListener="#{bindings.Create.execute}" text="Create"
                                               disabled="#{!bindings.Create.enabled}" id="b2"/>
                                </f:facet>
                            </af:panelFormLayout>
                        </af:panelFormLayout>
                        <af:button actionListener="#{bindings.First.execute}" text="First"
                                   disabled="#{!bindings.First.enabled}" partialSubmit="true" id="b5"/>
                        <af:button actionListener="#{bindings.Last.execute}" text="Last"
                                   disabled="#{!bindings.Last.enabled}" partialSubmit="true" id="b6"/>
                        <af:button actionListener="#{bindings.Next.execute}" text="Next"
                                   disabled="#{!bindings.Next.enabled}" partialSubmit="true" id="b7"/>
                        <af:button actionListener="#{bindings.Previous.execute}" text="Previous"
                                   disabled="#{!bindings.Previous.enabled}" partialSubmit="true" id="b8"/>
                    </af:gridCell>
                </af:gridRow>
                <af:gridRow height="50px" id="gr2">
                    <af:gridCell width="100%" halign="stretch" valign="stretch" id="gc1">
                        <!-- Footer -->
                    </af:gridCell>
                </af:gridRow>
            </af:panelGridLayout>
        </af:form>
    </af:document>
</f:view>

当我执行我的页面 jsf 时,我收到错误Nom id introuvable dans l'objet donné : /untitled2.jsf。

4

0 回答 0