Problem with iFrame

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bmohanpr
    New Member
    • Jul 2007
    • 2

    Problem with iFrame

    HI,
    I am using Iframes in my project .There are two jsps one is A.jsp another one is B.jsp In A.jsp I used iFrame to call B.jsp.The code will be as follows

    A.jsp

    Code:
    <html:html>
    <head>
    <script>
             function fnGetData(){
                   document.forms[0].action="sample.do?method=getData";
    	document.forms[0].target = "RoFrame";
    	document.forms[0].method = "POST";
    	document.forms(0).submit();	        
            }
    </head>
    <html:form action="/sample.do" method="post">
    <table>
    <tr>
       <a href="javascript:fnGetData()">Click</a>
    </tr>
        <tr> 
              <td  colspan="16" align=left >	    
    	<iframe id="RoFrame" name="RoFrame"  src="sample.do?method=assign" height=250 width=980 >
    	</iframe>		
               </td>					
        </tr>
    </html:form>
    </html:html>
    B.Jsp

    Code:
    <html:html>
    <body>
    <html:form action="/sample.do" method="post">
    ///Some presentation logic 
    
    </html:form>
    </body>
    </html:html>

    If I click the hyper link in A.jsp it is supposed to refresh the only the iFrame part.It is successfully refreshing the iFrame but entire page i.e content of both A.jsp and B.jsp is getting displayed in iFrame.
    Can any one help me out in this issue.

    Thanks ,
    Mohan.
    Last edited by gits; Jul 24 '07, 12:55 PM. Reason: added CODE tags
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by bmohanpr
    HI,
    I am using Iframes in my project .There are two jsps one is A.jsp another one is B.jsp In A.jsp I used iFrame to call B.jsp.The code will be as follows

    A.jsp

    <html:html>
    <head>
    <script>
    function fnGetData(){
    document.forms[0].action="sample .do?method=getD ata";
    document.forms[0].target = "RoFrame";
    document.forms[0].method = "POST";
    document.forms( 0).submit();
    }
    </head>
    <html:form action="/sample.do" method="post">
    <table>
    <tr>
    <a href="javascrip t:fnGetData()"> Click</a>
    </tr>
    <tr>
    <td colspan="16" align=left >
    <iframe id="RoFrame" name="RoFrame" src="sample.do? method=assign" height=250 width=980 >
    </iframe>
    </td>
    </tr>
    </html:form>
    </html:html>

    B.Jsp

    <html:html>
    <body>
    <html:form action="/sample.do" method="post">
    ///Some presentation logic

    </html:form>
    </body>
    </html:html>


    If I click the hyper link in A.jsp it is supposed to refresh the only the iFrame part.It is successfully refreshing the iFrame but entire page i.e content of both A.jsp and B.jsp is getting displayed in iFrame.
    Can any one help me out in this issue.

    Thanks ,
    Mohan.
    Copied to Javascript forum

    Comment

    • epots9
      Recognized Expert Top Contributor
      • May 2007
      • 1352

      #3
      Originally posted by bmohanpr
      HI,
      I am using Iframes in my project .There are two jsps one is A.jsp another one is B.jsp In A.jsp I used iFrame to call B.jsp.The code will be as follows

      A.jsp

      Code:
      <html:html>
      <head>
      <script>
               function fnGetData(){
                     document.forms[0].action="sample.do?method=getData";
      	document.forms[0].target = "RoFrame";
      	document.forms[0].method = "POST";
      	document.forms(0).submit();	        
              }
      </head>
      <html:form action="/sample.do" method="post">
      <table>
      <tr>
         <a href="javascript:fnGetData()">Click</a>
      </tr>
          <tr> 
                <td  colspan="16" align=left >	    
      	<iframe id="RoFrame" name="RoFrame"  src="sample.do?method=assign" height=250 width=980 >
      	</iframe>		
                 </td>					
          </tr>
      </html:form>
      </html:html>
      B.Jsp

      Code:
      <html:html>
      <body>
      <html:form action="/sample.do" method="post">
      ///Some presentation logic 
      
      </html:form>
      </body>
      </html:html>

      If I click the hyper link in A.jsp it is supposed to refresh the only the iFrame part.It is successfully refreshing the iFrame but entire page i.e content of both A.jsp and B.jsp is getting displayed in iFrame.
      Can any one help me out in this issue.

      Thanks ,
      Mohan.
      when u submit a page it does that, it has to refresh when u submit a form.

      what u can do is instead of submitting the form, use javascript to read the input and attach to the url (like a get request, won't work correctly if it is greater than 100 characters), then tell your iframe to use that url. also your page B (the iframe one) will have to be able to handle get instead of post now.

      another way would be to try out ajax.

      good luck

      Comment

      Working...