Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Accessing form elements of parent JSP inside child JSP

    Hi

    I have a JSP page with 5 dropdowns. Below the dropdowns i have a tabset. Below the tabset i have a HTMLPane in which i load a JSP page when user clicks on a tab from the tabset.
    In the child JSP page i have four dropdowns and a GO button.

    The use case is:
    User selects values in all the 5 dropdowns in parent JSP and clicks on a tab. Then i will load the child JSP page with four dropdowns whose values are fetched from database depending on the values selected in the dropdowns of parent JSP.
    Now user selects values from the dropdowns in child JSP and clicks on GO button which is in child JSP. At this time i need, the selected dropdown values of parent JSP as well as the child JSP to display the rest of the content of child JSP.

    I tried accessing the form elements of parent JSP in the similar way, how we normally do with in the single page. But it is not working.

    Is it possible to access the form elements of parent JSP in child JSP? if Yes how to access?

    #2
    Have you set contentsType:"page" on your HTMLPane, despite the warning that it should never be used to load SmartClient components? If so, go back to the docs and read about why you shouldn't do that.

    Comment


      #3
      Hi Isomorphic

      I am having a child JSP with in a window, not HTMLPane.

      SmartClient.jsp file contains few dropdowns and a window, this SmartClient.jsp is the parent JSP. On some action i will set the window.setSrc as Child.jsp.

      How Can i access the values of dropdowns present in SmartClient.jsp in the Child.jsp. Where the child.jsp is inside the window of SmartClient.jsp

      I wrote code like:
      var str = parentForm.getValue('dropdown1') -- inside child.jsp
      I am not able to access.

      Comment


        #4
        If you can't access those controls directly, then you are still using an IFRAME, which probably happened because you set Window.src.

        Take a look at the docs for HTMLPane.contentsType, it explains the right approach.

        Comment


          #5
          No where in my window definition i have set the contentsType property. I have just set the action for window.setSrc.

          src: "/analytics/screens/finData.action"

          This renders the screen dynamically with in the window. The screen displayed this way uses a .jsp file with only struts tags in it.

          you have replied "then you are still using an IFRAME, which probably happened because you set Window.src." How to avoid formation of IFrames?

          In few cases i will set src as
          src: "/analytics/screens/retData.jsp"

          This retData.jsp file contains only smartclient components like listgrid, dropdowns etc... these are drawn when respective datasources are called while loading.

          In both the scenarios i need to access the dropdowns in the parent JSP file to continue further operations.
          In the second case i can use ViewLoader class so that i will be able access all the parent components.
          But what i can do in first case. Then changing my screens design is the only option in first case right?

          Comment


            #6
            Hi Strive,

            The docs are pretty clear on this - please read them more closely.

            Using Window.src/setSrc() uses an HTMLFlow with contentsType:"page" by default.

            To load SmartClient components, use a ViewLoader. To load plain HTML, use an HTMLFlow with contentsType not set to "page".

            Comment

            Working...
            X