Question

Trouble getting java variable to load in iframe src

Asked by: the_hero

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

This question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Sign Up Now!
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)

Participating Experts
2
Points
500
Comments
45

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

Companies like CVS, Honeywell, Chevron, Toyoto, TriStar Pictures, the U.S. Army, and Accenture

Your Complete Technology Resource

900+ topic areas (and counting)

Related Solutions

  1. Iframe and SRC
    Hi I have an iframe on a main page which will load a different page depending on who logged on. Which is where I assign the below session variable <Iframe src="<% Session("subform") %>" .......</iframe&...
  2. change iframe src
    im trying to to do something very simple. this is my iframe: <iframe align="<%=align%>" designMode="on" id="ifrm" width="100%"></iframe> when the user selects something from the ...
  3. IFRAME tag: Can I use GET method in src attribu…
    Hello, The iframe tag has the attribute src, as in <iframe SRC="default.html"> Is it possible to use GET method in the SRC url? What I would like to do is something like this: <iframe SRC="/cgi-bin/myfile.cgi?...
  4. Changing the src attribute of the IFRAME
    I need to change the src attribute of my IFRAME element in my main page (through code). I used to use Javascript to do it classic ASP, i.e., document.iframe.src = "somewhere.html" Thanks in advance.
Tutorials are great ways to tackle hard problems!

Featured Articles

Read through articles written by top experts!

Get full access to the help you need.

Subscribe Now

30-day free trial. Register in 60 seconds.

The Latest Technology News and Tips

Your answer is only minutes away!

New Solutions Everyday

Because of our active community of experts, on average new questions receive their first comment in under 30 minutes.

Top Java Questions

       

Hear What our Users are Saying

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

20130221-EE-VQP-038

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Development.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Microsoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...an excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans