THIS MONTH ONLY

25% OFF YOUR FIRST YEAR

Use code: FIRSTYEAR25

Welcome to the #1 Community for Technology Professionals.

Trouble getting java variable to load in iframe src

Asked by: the_heroSolved by:

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

Asked On
2008-12-19 at 21:51:58ID: 24000187
Tags

iframe

,

java

,

html

Topics

Java Programming Language

,

Hypertext Markup Language (HTML)

,

Java Server Pages (JSP)

Comments
45

This solution is premium contentAccess this technology solution plus 4 million more as a premium member.

Become a Premium Member

  • Solve problems faster with premium solutions and 1-on-1 expert help
  • Advance your technical skills with access to training resources
  • Grow your career by networking with industry thought leaders

Try it Free

30 day free trial. Cancel anytime.

Experts Exchange is trusted by 44 of the top 50 Fortune 500 companies.

How It Works

Put the power of 100,000 technical experts to work for you. Whether you're stuck with a difficult problem, need to expand you skills, or want to network with others in your technical area, our global expert community will help you get your job done and become a better professional.

Michael Victors Independent IT Consultant California, USA

Jon McAdams Network Manager B.C., Canada

Chris Habina System Engineer London, England

Greg Reynolds IT Manager Texas, USA

Hear from Our Community

"Three years back we had a client requirement for developing an asset tracking solution that required data acquisition from different data sources. I was assigned the role of DBA. With no practical experience in database administration, I was clueless on how to proceed. Thanks to the guidance and support of Experts Exchange's vast talent pool, I was able to complete the data integration process in less than a week's time, which saved our company more than $2000 worth of man-hours and got me a promotion!"

Sherkar Bhurshan

RFID Consultant at Aplomb Global IT Consultants

"My Staff and I use EE on a daily bases to solve all kinds of issues. One answer can be worth the cost of a lifetime membership! For example, we ran into a bunch of problems when migrating our Exchange environment from 2003 to 2010. We kept running into issues and repeatedly the best and most detailed info was coming from Experts Exchange. One of the last issues was getting active sync and OWA published correctly and the partners we were using were struggling for hours. Finally I decided to go look for my own answers and was able to find what was looking for on Experts Exchange. It was a life saver!"

Jakub Hanson

Director of Infrastructure at Noel Group LLC

"A few years back, I worked for a British bank in compliance. When the bank sold its trading department to an American company, the compliance systems had to change rapidly to avoid managers being charged with not submitting compliance reports to the government, which would have been a criminal offence. Experts Exchange helped me get the job done on time."

Murray Brown

Programmer at Murbro Ltd

201401-VQP-099

Experts Exchange powers the
growth and success of technology
professionals worldwide.

Try it Free

30 day free trial. Cancel anytime.

Learn More about How It Works

Get Experts Exchange's

Career Builder Guide

Become successful in your tech career.

We will never share this with anyone.

Deeper Java LearningDevelop your expertise with tips, tricks and how to expert articles.

Experts Exchange is the Network for
Technology Professionals

  • An essential resource for producing excellent work

    Experts Exchange is the tech professional’s trusted, on-demand resource for solving difficult problems, making informed decisions, and delivering excellent solutions.

  • A better way to learn technology

    With unparalleled access to technical experts, verified real-world solutions, and diverse educational content, Experts Exchange enables personalized development of technology skills.

  • The network for building your tech career

    Experts Exchange gives you the professional exposure and valued relationships key to building the career you want.

Experts Exchange powers the growth and
success of technology professionals worldwide.

Try it Free

30 day free trial. Cancel anytime.