LifeCycleListener, requestDestroyed(ServletRequestEvent event)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • emadattalla1983
    New Member
    • Apr 2007
    • 24

    LifeCycleListener, requestDestroyed(ServletRequestEvent event)

    Well,
    I've a problem..
    I am developing simple sample web site, it is only 2 pages...
    when I move to the second page, I want to change some labels' and controls' Text and Style <ex. left = 133 instead of left = 10>.
    This depends on some session attribute value from page1, I receive it successfully and work using it.

    The problem is that LifeCyclelisten er... destroys all changes and reset the default values !!

    While tracing, I think the responsible of this is <requestDestroy ed(ServletReque stEvent event)> method.

    Do you have any idea about this problem and how to deal with it ?

    Thanks alot,
    Emad Attalla
  • emadattalla1983
    New Member
    • Apr 2007
    • 24

    #2
    I am using NetBeans5.5
    on Sun Java System Application Server 9
    I get new Data from SQL SERVER 2005 DB
    Thanks

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by emadattalla1983
      Well,
      I've a problem..
      I am developing simple sample web site, it is only 2 pages...
      when I move to the second page, I want to change some labels' and controls' Text and Style <ex. left = 133 instead of left = 10>.
      This depends on some session attribute value from page1, I receive it successfully and work using it.

      The problem is that LifeCyclelisten er... destroys all changes and reset the default values !!

      While tracing, I think the responsible of this is <requestDestroy ed(ServletReque stEvent event)> method.

      Do you have any idea about this problem and how to deal with it ?

      Thanks alot,
      Emad Attalla
      If you are using JSPs you can pass the value as hidden input fields rather than through the session and get them in the second page using request.getPara meter("fildName ")

      Comment

      • emadattalla1983
        New Member
        • Apr 2007
        • 24

        #4
        Originally posted by r035198x
        If you are using JSPs you can pass the value as hidden input fields rather than through the session and get them in the second page using request.getPara meter("fildName ")
        First, thanks for reply...
        But this is not the problem, the problem is in Request Destroy which works like undo my all new work and gets initial values back.
        The problem not in the session parameter value

        Comment

        • emadattalla1983
          New Member
          • Apr 2007
          • 24

          #5
          Please, do you know how to stop LifeCycleListen er of calling requestDestroye d(..) ?

          I created a simple test web application using NetBeans5.5 ..
          it has a label and its text is "Old Value"
          and in the init() method, I added small code after _init() code:
          this.Label1.set Text("New Value");

          this new string assigned to Label1.text does affect but then the lifeCycleListen er class does like cancelling it and re-intializing and setting the text = "Old Value" !!!

          I do not understand why ? and how to stop.

          Note: when the text value of the Label is null : ""

          "New Value" shows up correctly !!

          Please help !

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by emadattalla1983
            Please, do you know how to stop LifeCycleListen er of calling requestDestroye d(..) ?

            I created a simple test web application using NetBeans5.5 ..
            it has a label and its text is "Old Value"
            and in the init() method, I added small code after _init() code:
            this.Label1.set Text("New Value");

            this new string assigned to Label1.text does affect but then the lifeCycleListen er class does like cancelling it and re-intializing and setting the text = "Old Value" !!!

            I do not understand why ? and how to stop.

            Note: when the text value of the Label is null : ""

            "New Value" shows up correctly !!

            Please help !
            Maybe if you post some of your code ...

            Comment

            • emadattalla1983
              New Member
              • Apr 2007
              • 24

              #7
              Here you are the code.. thanks...

              public void init() {
              // Perform initializations inherited from our superclass
              super.init();
              // Perform application initialization that must complete
              // *before* managed components are initialized
              // TODO - add your own initialiation code here

              // <editor-fold defaultstate="c ollapsed" desc="Managed Component Initialization" >
              // Initialize automatically managed components
              // *Note* - this logic should NOT be modified
              try {
              _init();
              } catch (Exception e) {
              log("Page1 Initialization Failure", e);
              throw e instanceof FacesException ? (FacesException ) e: new FacesException( e);
              }

              // </editor-fold>
              // Perform application initialization that must complete
              // *after* managed components are initialized
              // TODO - add your own initialization code here

              this.label1.set Text("New Value !!!");
              }

              As you see, the bold italic line is the only modification that I do...
              default value of text of label1 is "Label1".
              Then when run the application, the result is "Label1" not "New Value !!!"
              That's it

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by emadattalla1983
                Here you are the code.. thanks...

                public void init() {
                // Perform initializations inherited from our superclass
                super.init();
                // Perform application initialization that must complete
                // *before* managed components are initialized
                // TODO - add your own initialiation code here

                // <editor-fold defaultstate="c ollapsed" desc="Managed Component Initialization" >
                // Initialize automatically managed components
                // *Note* - this logic should NOT be modified
                try {
                _init();
                } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException ) e: new FacesException( e);
                }

                // </editor-fold>
                // Perform application initialization that must complete
                // *after* managed components are initialized
                // TODO - add your own initialization code here

                this.label1.set Text("New Value !!!");
                }

                As you see, the bold italic line is the only modification that I do...
                default value of text of label1 is "Label1".
                Then when run the application, the result is "Label1" not "New Value !!!"
                That's it
                You'll need to reshow the interface for your changes to be reflected.

                Comment

                • emadattalla1983
                  New Member
                  • Apr 2007
                  • 24

                  #9
                  Please tell me how to reshow it ?
                  Thanks alot

                  Comment

                  • r035198x
                    MVP
                    • Sep 2006
                    • 13225

                    #10
                    Originally posted by emadattalla1983
                    Please tell me how to reshow it ?
                    Thanks alot
                    What kind of interface do you have?

                    Comment

                    • emadattalla1983
                      New Member
                      • Apr 2007
                      • 24

                      #11
                      I did not get what you mean by kind of interface..
                      anyway, below is the jsp code for the web page I create..
                      Code:
                      <?xml version="1.0" encoding="UTF-8"?>
                      <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
                          <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
                          <f:view>
                              <ui:page binding="#{Page1.page1}" id="page1">
                                  <ui:html binding="#{Page1.html1}" id="html1">
                                      <ui:head binding="#{Page1.head1}" id="head1">
                                          <ui:link binding="#{Page1.link1}" id="link1" url="/resources/stylesheet.css"/>
                                      </ui:head>
                                      <ui:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
                                          <ui:form binding="#{Page1.form1}" id="form1">
                                              <ui:label binding="#{Page1.label1}" id="label1" style="left: 480px; top: 192px; position: absolute" text="Label1"/>
                                              <ui:hyperlink binding="#{Page1.hyperlink1}" id="hyperlink1" style="position: absolute; left: 408px; top: 384px" text="Itself" url="/faces/Page1.jsp"/>
                                          </ui:form>
                                      </ui:body>
                                  </ui:html>
                              </ui:page>
                          </f:view>
                      </jsp:root>
                      I am using NetBeans5.5 as IDE and creating Visual Web Application project.
                      I wish I declared needed information.
                      Thanks alot

                      Comment

                      • r035198x
                        MVP
                        • Sep 2006
                        • 13225

                        #12
                        Originally posted by emadattalla1983
                        I did not get what you mean by kind of interface..
                        anyway, below is the jsp code for the web page I create..
                        Code:
                        <?xml version="1.0" encoding="UTF-8"?>
                        <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
                        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
                        <f:view>
                        <ui:page binding="#{Page1.page1}" id="page1">
                        <ui:html binding="#{Page1.html1}" id="html1">
                        <ui:head binding="#{Page1.head1}" id="head1">
                        <ui:link binding="#{Page1.link1}" id="link1" url="/resources/stylesheet.css"/>
                        </ui:head>
                        <ui:body binding="#{Page1.body1}" id="body1" style="-rave-layout: grid">
                        <ui:form binding="#{Page1.form1}" id="form1">
                        <ui:label binding="#{Page1.label1}" id="label1" style="left: 480px; top: 192px; position: absolute" text="Label1"/>
                        <ui:hyperlink binding="#{Page1.hyperlink1}" id="hyperlink1" style="position: absolute; left: 408px; top: 384px" text="Itself" url="/faces/Page1.jsp"/>
                        </ui:form>
                        </ui:body>
                        </ui:html>
                        </ui:page>
                        </f:view>
                        </jsp:root>
                        I am using NetBeans5.5 as IDE and creating Visual Web Application project.
                        I wish I declared needed information.
                        Thanks alot
                        That is not JSP code. That is XML.

                        Comment

                        • emadattalla1983
                          New Member
                          • Apr 2007
                          • 24

                          #13
                          I did not write any code... cause I am developing simple example
                          This is the created source jsp to the designed page.
                          Are you familiar to NetBeans ?

                          Comment

                          • r035198x
                            MVP
                            • Sep 2006
                            • 13225

                            #14
                            Originally posted by emadattalla1983
                            I did not write any code... cause I am developing simple example
                            This is the created source jsp to the designed page.
                            Are you familiar to NetBeans ?
                            I'm a little familiar with NetBeans (I like to write the code myself) but that is still XML as is evidenced by the XML prolog at the begining of the file.

                            Comment

                            • emadattalla1983
                              New Member
                              • Apr 2007
                              • 24

                              #15
                              anyway, I think we reached nothing till now...
                              what do we need to reach help if possible ?
                              thanks

                              Comment

                              Working...