0

私はウェブページを持っています: TRY 、そのページから別のページに行きたい: TRY2

jsp TRY.jsp:

    <%@taglib uri="http://www.sun.com/webui/webuijsf" prefix="webuijsf"%><%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
    <%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
    <f:view>
<f:loadBundle basename="it.eni.italgas.sam.web.dictionary"
    var="bundle" />
<webuijsf:page id="page1" rendered="#{UserBean.userEnabled}">
    <webuijsf:html id="html1">
        <webuijsf:head id="head1" parseOnLoad="false"
            title="Pagina di prova" webuiOnLoad="false">
            <webuijsf:link id="link1" url="/resources/stylesheet.css" />
        </webuijsf:head>
        <webuijsf:body id="body1" style="-rave-layout: grid"
        styleClass="pageLayout">

            <webuijsf:form id="form1">
            <webuijsf:button actionExpression="#{Prova.button1_action}"
                id="button1"
                style="height: 24px; left: 23px; top: 216px; position: absolute; width: 72px"
                text="#{bundle.TastoConferma}" />
            <webuijsf:calendar dateFormatPattern="dd/MM/yyyy"
                dateFormatPatternHelp="dd/MM/yyyy" id="startDate" immediate="true"
                selectedDate="#{ALGUISessionBean.startDate}"
                style="height: 24px; left: 168px; top: 120px; position: absolute; width: 192px" />
            <webuijsf:calendar dateFormatPattern="dd/MM/yyyy"
                dateFormatPatternHelp="dd/MM/yyyy" id="endDate" immediate="true"
                selectedDate="#{ALGUISessionBean.endDate}"
                style="height: 24px; left: 168px; top: 168px; position: absolute; width: 192px" />
            <webuijsf:dropDown binding="#{AlGui02_1.dropDown1}" id="dropDown1"
                items="#{ALGUI02RequestBean.dropDownPlantList_ricerca}"
                selected="#{ALGUISessionBean.dropDown1SelectedOption_ricerca}"
                style="height: 24px; left: 168px; top: 72px; position: absolute"
                width="260" />
            <webuijsf:label id="label4"
                style="height: 24px; left: 24px; top: 72px; position: absolute; width: 142px"
                text="#{bundle.NomeImpiantoProva}" />
            <webuijsf:label id="label1"
                style="font-size: 14px; height: 24px; left: 24px; top: 24px; position: absolute; width: 432px"
                text="#{bundle.TitoloGuiProva}" />
            <webuijsf:label id="label2"
                style="height: 24px; left: 24px; top: 120px; position: absolute; width: 142px"
                text="#{bundle.DataInizioProva}" />
            <webuijsf:label id="label3"
                style="height: 24px; left: 24px; top: 168px; position: absolute; width: 142px"
                text="#{bundle.DataFineProva}" />
            <webuijsf:message for="startDate" id="message1" showDetail="false"
                showSummary="true"
                style="position: absolute; left: 384px; top: 120px; width: 168px; height: 24px" />
            <webuijsf:message for="endDate" id="message2" showDetail="false"
                showSummary="true"
                style="position: absolute; left: 384px; top: 168px; width: 168px; height: 24px" />
            <h:messages errorClass="errorMessage" fatalClass="fatalMessage"
                globalOnly="true" id="messageList1" infoClass="infoMessage"
                style="border-width: 1px; height: 22px; left: 24px; top: 264px; position: absolute"
                warnClass="warnMessage" />
            <br />
        </webuijsf:form>
    </webuijsf:body>
    </webuijsf:html>
</webuijsf:page>

TRY2 の jsp:

  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
  <%@taglib uri="http://www.sun.com/webui/webuijsf" prefix="webuijsf"%>
  <%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
  <%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
  <f:view>

<webuijsf:page id="page1">
    <webuijsf:html id="html1">
        <webuijsf:head id="head1" parseOnLoad="false"
            title="Pagina di prova2" webuiOnLoad="false">
            <webuijsf:link id="link1" url="/resources/stylesheet.css" />
        </webuijsf:head>
        <webuijsf:body id="body1" style="-rave-layout: grid"
        styleClass="pageLayout">

        TRY TRY

        </webuijsf:body>
    </webuijsf:html>
</webuijsf:page>

TRY の Java マネージド Bean:

public class TRY extends AbstractPageBean{

private String nomeClasse = this.getClass().getSimpleName();
private String distrib = getUserBean().getCurrentDatasource();
private String username = getUserBean().getUser();
private Date startDate;
private Date endDate;
private DropDown dropDown1;

private Logger logger;

public TRY() {

    logger = Logger.getLogger(getClass());

    logger.debug("Class TRY....");
}

@Override
public void init() {
    super.init();


    try {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.INIT, LogMessages.INIT_OK), null);
    } catch (Exception e) {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.INIT, "KO: " + e.getMessage()), null);
        throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
    }
}

@Override
public void preprocess() {
    try {


        getUserBean().navigationStatus();
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PREPROCESS, "OK"), null);
    } catch (IOException e) {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PREPROCESS, "KO: " + e.getMessage()), null);
    }
}

@Override
public void prerender() {
    try {

        logger.debug("Class TRY....PRERENDER");

        getUserBean().navigationStatus();
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PRERENDER, "OK"), null);

        ALGUISessionBean session = getALGUISessionBean();

        if (session.isError()) {
            log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PRERENDER, LogMessages.PRERENDER_VAL_ER), null);
            session.setError(false);
        } else {
            resetOwnSessionVars();
        }

        logger.debug("Classe di prova....PRERENDER fine");
    } catch (Exception e) {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PRERENDER, "KO: " + e.getMessage()), null);
    }
}

@Override
public void destroy() {
    log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.DESTROY, LogMessages.DESTROYED), null);
}

/* -------------------
 * - GETTER & SETTER -
 * ------------------*/
protected ALGUISessionBean getALGUISessionBean() {
    return (ALGUISessionBean) getBean("ALGUISessionBean");
}

protected UserBean getUserBean() {
    return (UserBean) getBean("UserBean");
}

public DropDown getDropDown1() {
    return dropDown1;
}

public void setDropDown1(DropDown dd) {
    this.dropDown1 = dd;
}

private void resetOwnSessionVars() {

    ALGUISessionBean session = getALGUISessionBean();

    log(LogMessages.getLogString(username, distrib, nomeClasse, "resetOwnSessionVars", LogMessages.INIZIO), null);
    session.setStartDate(null);
    session.setEndDate(null);
    session.setdropDown1SelectedOption_ricerca(null);
    session.setPlantLabel(null);
    log(LogMessages.getLogString(username, distrib, nomeClasse, "resetOwnSessionVars", LogMessages.FINE), null);
}

public String button1_action() {

     logger.debug("Class prova....button1_action ");
     ALGUISessionBean session = getALGUISessionBean();

     log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.BUTTON1, LogMessages.INIZIO), null);

     session.setStartDate(startDate);
     session.setEndDate(endDate);
     logger.debug("Class prova....button1_action return ");

     return "TRY2";
}

}

TRY2 の Java マネージド Bean:

public class TRY2 extends AbstractPageBean{

private String nomeClasse = this.getClass().getSimpleName();
private String distrib = getUserBean().getCurrentDatasource();
private String username = getUserBean().getUser();


private Logger logger;

public TRY2() {

    logger = Logger.getLogger(getClass());

    logger.debug("Class  TRY2....");
}

@Override
public void init() {
    super.init();


    try {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.INIT, LogMessages.INIT_OK), null);
    } catch (Exception e) {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.INIT, "KO: " + e.getMessage()), null);
        throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
    }
}

@Override
public void preprocess() {
    try {


        getUserBean().navigationStatus();
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PREPROCESS, "OK"), null);
    } catch (IOException e) {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PREPROCESS, "KO: " + e.getMessage()), null);
    }
}

@Override
public void prerender() {
    try {

        logger.debug("Class  TRY2....PRERENDER");

        getUserBean().navigationStatus();
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PRERENDER, "OK"), null);

    } catch (Exception e) {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PRERENDER, "KO: " + e.getMessage()), null);
    }

    ALGUISessionBean session = getALGUISessionBean();

    if (session.isError()) {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.PRERENDER, LogMessages.PRERENDER_VAL_ER), null);
        session.setError(false);
    } else {
        resetOwnSessionVars();
    }
}

@Override
public void destroy() {
    log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.DESTROY, LogMessages.DESTROYED), null);
}

/* -------------------
 * - GETTER & SETTER -
 * ------------------*/
protected ALGUISessionBean getALGUISessionBean() {
    return (ALGUISessionBean) getBean("ALGUISessionBean");
}

protected UserBean getUserBean() {
    return (UserBean) getBean("UserBean");
}
}
}

face-config.xml の naviagion のルール

   <navigation-rule>
     <from-view-id>/TRY.jsp</from-view-id>
   <navigation-case>
   <from-outcome>TRY2</from-outcome>
   <to-view-id>/TRY2.jsp</to-view-id>
   </navigation-case>
   </navigation-rule>



  <managed-bean>
  <managed-bean-name>TRY</managed-bean-name>
  <managed-bean-class>web.TRY</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>
  <managed-bean>
  <managed-bean-name>TRY2</managed-bean-name>
  <managed-bean-class>web.TRY2</managed-bean-class>
  <managed-bean-scope>request</managed-bean-scope>
  </managed-bean>

ロガーは私に示します:

  logger.debug("Class TRY....button1_action ");    

  logger.debug("Class TRY....button1_action return ");

つまり、メソッド button_click の中に入るということです

そして、私はそれがログに記録されているのを見ます:

  logger.debug("Class TRY2....");

  logger.debug("Class TRY2....PRERENDER");

つまり、Bean TRY2 の中に入るということです

しかし、TRY2ページが表示されないのはなぜですか?

私はjavascriptが言うのを見ます:

  <script type="text/javascript">new webui.suntheme4_2.body('/TRY2.jsp', '/sam-fe-web/faces/TRY2.jsp',null,null,'com_sun_webui_util_FocusManager_focusElementId',true);</script></body></html>


  Uncaught TypeError: undefined is not a function

助けはありますか?

誰も私を助けてくれませんでした 本当にありがとうございました......

解決策は追加することでした

private void _init() throws Exception {
}

private Page page1 = new Page();

public Page getPage1() {
    return page1;
}

public void setPage1(Page p) {
    this.page1 = p;
}
private Html html1 = new Html();

public Html getHtml1() {
    return html1;
}

public void setHtml1(Html h) {
    this.html1 = h;
}
private Head head1 = new Head();

public Head getHead1() {
    return head1;
}

public void setHead1(Head h) {
    this.head1 = h;
}
private Link link1 = new Link();

public Link getLink1() {
    return link1;
}

public void setLink1(Link l) {
    this.link1 = l;
}
private Body body1 = new Body();

public Body getBody1() {
    return body1;
}

public void setBody1(Body b) {
    this.body1 = b;
}
private Form form1 = new Form();

public Form getForm1() {
    return form1;
}

public void setForm1(Form f) {
    this.form1 = f;
}
private Link link2 = new Link();

public Link getLink2() {
    return link2;
}

public void setLink2(Link l) {
    this.link2 = l;
}

  public void init() {
    super.init();


    logger.debug("Classe di prova....INIT");

    try {
         _init();
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.INIT, LogMessages.INIT_OK), null);
    } catch (Exception e) {
        log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.INIT, "KO: " + e.getMessage()), null);
        throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
    }
}
4

1 に答える 1

0
 add this into the TRY2.java class

 private void _init() throws Exception {
 }

 private Page page1 = new Page();

 public Page getPage1() {
      return page1;
 }

 public void setPage1(Page p) {
     this.page1 = p;
 }
 private Html html1 = new Html();

 public Html getHtml1() {
     return html1;
 }

 public void setHtml1(Html h) {
     this.html1 = h;
 }
 private Head head1 = new Head();

 public Head getHead1() {
     return head1;
 }

 public void setHead1(Head h) {
     this.head1 = h;
 }
 private Link link1 = new Link();

 public Link getLink1() {
     return link1;
 }

 public void setLink1(Link l) {
     this.link1 = l;
 }
 private Body body1 = new Body();

 public Body getBody1() {
     return body1;
 }

 public void setBody1(Body b) {
     this.body1 = b;
 }
 private Form form1 = new Form();

 public Form getForm1() {
     return form1;
 }

 public void setForm1(Form f) {
     this.form1 = f;
 }
 private Link link2 = new Link();

 public Link getLink2() {
          return link2;
 }

 public void setLink2(Link l) {
     this.link2 = l;
 }

init() を次のように編集します。

public void init() {
super.init();


logger.debug("Classe di prova....INIT");

try {
     _init();
    log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.INIT, LogMessages.INIT_OK), null);
} catch (Exception e) {
    log(LogMessages.getLogString(username, distrib, nomeClasse, LogMessages.INIT, "KO: " + e.getMessage()), null);
    throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
}
}
于 2013-03-08T23:13:23.700 に答える