Trouble getting java variable to load in iframe src

    Question by:
    On

    Topics:

    I have two java variables that are determined when a user clicks a link.  The variables are key identifiers and allow me to reference other database variables depending on which ones are selected.  The link points to two iframes and loads them through the src attribute.   The src contains references to the two key variables.  I can verify that the link is properly sending the variables.  But the iframe src lines are not receiving them because I am unable to get other information that is in the same record as the key references.

    This is strange because I can use the exact same syntax in other methods for passing the variables. IE, A tags, form submits, etc.  But it is not working in the iframe src.

    Here is the first link that the user clicks to determine the variables using our java ap and our database.  You will see the two key variables in the href as page ID and layout ID.
     
    <dl class="dropdown">
        <ul>
               <% 
                 for (int i=0; i<ResponseBean.getSizeOfDynamicPages(); i++)
                 {
                     %>
          <li><a class="underline" target="iframe_i_contain" href="<%= response.encodeURL("DynamicPagesEditServlet?action=&success=m1_dynamic_nav_contain.jsp&error="+ request.getServletPath()+"&"+com.ideaorbit.servlets.DynamicPagesEditServlet.HTTP_REQUEST_FIELD_KEY_ABOUT_PAGE_ID+"="+ResponseBean.getDynamicPagesID(i)+"&"+com.ideaorbit.servlets.DynamicLayoutsEditServlet.HTTP_REQUEST_FIELD_KEY_ABOUT_LAYOUT_ID+"="+ResponseBean.getSiteHomepageReference(i) ) %>"
       onclick="doBoth();"><%= ResponseBean.getDynamicPagesAlias(i) %></a></li>
     
               <% } %>
        </ul>
    <div style="clear:both" />
     
     
     
    Here is the onclick javascript.
     
    <script type="text/javascript">
    function doBoth() {
    frames['iframe_i_nav'].location.href = '<%= response.encodeURL("DynamicPagesEditServlet?action=&success=m1_dynamic_nav1.jsp&error="+ request.getServletPath()+"&"+com.ideaorbit.servlets.DynamicPagesEditServlet.HTTP_REQUEST_FIELD_KEY_ABOUT_PAGE_ID+"="+ResponseBean.getDynamicPagesID(0)+"&"+com.ideaorbit.servlets.DynamicLayoutsEditServlet.HTTP_REQUEST_FIELD_KEY_ABOUT_LAYOUT_ID+"="+ResponseBean.getSiteHomepageReference(0) ) %>"';
    }
    </script>
     
     
    Here is the iframe.  This iframe is a container which holds two more iframes.
     
    <iframe name="iframe_i_contain" frameborder="0" width="100%" height="460" align="top" scrolling="no">
    </iframe>
     
     
    Here are the two iframes that the above iframe container holds.
     
    <iframe name="iframe_i_nav2" scrolling="no" frameborder="0" width="100%" height="30" align="top" src="<%= response.encodeURL("DynamicLayoutsEditServlet?action=&success=m1_dynamic_nav2.jsp&error="+ request.getServletPath()+"&"+com.ideaorbit.servlets.DynamicLayoutsEditServlet.HTTP_REQUEST_FIELD_KEY_ABOUT_LAYOUT_ID+"="+ResponseBean.getSiteHomepageReference(0)+"&"+com.ideaorbit.servlets.DynamicPagesEditServlet.HTTP_REQUEST_FIELD_KEY_ABOUT_PAGE_ID+"="+ResponseBean.getDynamicPagesID(0) ) %>">
    If you can see this, your browser does not support iframes!
    </iframe>
    <iframe name="iframe_i_edit" frameborder="0" width="100%" height="400" align="top" src="<%= response.encodeURL("DynamicLayoutsEditServlet?action=&success="+ResponseBean.getDynamicPagesTemplateReference(0)+"/editnone"+ResponseBean.getDynamicLayoutsLayout(0)+".jsp&error="+ request.getServletPath()+"&"+com.ideaorbit.servlets.DynamicLayoutsEditServlet.HTTP_REQUEST_FIELD_KEY_ABOUT_LAYOUT_ID+"="+ResponseBean.getSiteHomepageReference(0)+"&"+com.ideaorbit.servlets.DynamicPagesEditServlet.HTTP_REQUEST_FIELD_KEY_ABOUT_PAGE_ID+"="+ResponseBean.getDynamicPagesID(0) ) %>">
    If you can see this, your browser does not support iframes!
    </iframe>
     
    If the layout ID and the page ID are correctly passed along, then the "getDynamicPagesTemplateReference" and the "getDynamicLayoutsLayout" will point to the correct data.
     
    However, they ID variables are not making it to this point as when the container iframes load, it just loads the default values.  
     
    Again, the above syntax is working in other places of my code, just not the iframes.
     
    FYI, these are all JSP pages.  Thanks for any help.
    
                                    
    1:
    2:
    3:
    4:
    5:
    6:
    7:
    8:
    9:
    10:
    11:
    12:
    13:
    14:
    15:
    16:
    17:
    18:
    19:
    20:
    21:
    22:
    23:
    24:
    25:
    26:
    27:
    28:
    29:
    30:
    31:
    32:
    33:
    34:
    35:
    36:
    37:
    38:
    39:
    40:
    41:
    42:
    43:
    44:
    45:
    46:
    47:
    48:
    

    Select allOpen in new window

    Good Question?
    0
     

    ?

    The member who asked this question verified this comment provided the solution that solved their problem.

    Accepted Solution on 2008-12-29 at 16:21:45ID: 23259730

    that code also includes changes that I suggested :)

    Top Expert Contributor

    Essential articles and videos from the Experts

    More valuable questions with Expert answers

    201511-LO-Qu-074

    Extend your technology team with the Experts Exchange community.

    — trusted by —

    Who answers my questions?Our community has technology experts around the world.

    mccarl

    1,412

    Solutions

    Expert in:

    • Java
    • Java EE
    • Programming-Other
    • JSP
    • Algorithms

    gurpsbassi

    205

    Solutions

    Expert in:

    • Java
    • Java EE
    • JSP
    • Programming-Other

    CEHJ

    16,822

    Solutions

    Expert in:

    • Java
    • Java EE
    • Editors IDEs
    • JSP
    • Programming Languages-Other

    gheist

    5,206

    Solutions

    Expert in:

    • Linux
    • Unix OS
    • Linux Distributions
    • Networking-Other
    • Apache Web Server

    Valeri

    462

    Solutions

    Expert in:

    • Java
    • JSP
    • Java EE

    mrcoffee365

    1,048

    Solutions

    Expert in:

    • JSP
    • Java
    • Web Development-Other
    • Java EE
    • Apache Web Server

    Paul Maxwell

    9

    Articles

    2,790

    Solutions

    Expert in:

    • MS SQL Server
    • MS SQL Server 2008
    • Query Syntax
    • MS SQL Server 2005
    • Oracle Database

    ozo

    13,788

    Solutions

    Expert in:

    • Perl
    • Math / Science
    • Regular Expressions
    • Shell Scripting
    • Algorithms

    Peter Kwan

    481

    Solutions

    Expert in:

    • Java
    • MS Excel
    • Oracle Database

    RELATED TOPICS view all topics

    1. Java EE
      (16,910)
    2. Editors IDEs
      (25,097)
    3. JSP
      (15,370)
    4. Programming-Other
      (51,631)
    5. Programming Languages-Other
      (19,578)
    6. Java App Servers
      (7,000)
    7. Web Servers
      (32,323)
    8. Web Languages/Standards-Other
      (39,427)
    9. JavaScript
      (117,365)
    10. Oracle Database
      (77,161)