Tuesday, 3 January 2012

Change value of Element in IFRAME using javascript....

  var IframeID=document.getElementById("myIFrame");
     var eyeframedoc;
           eyeframedoc = IframeID.contentWindow ? IframeID.contentWindow.document: IframeID.contentDocument;
     eyeframedoc.getElementById("elementInsideInIframe").value="any value";

Create print view using javascript to print perticular div

<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
    <script type="text/javascript">     
       function PrintDiv() {    

          var divToPrint = document.getElementById('divToPrint');
          var popupWin = window.open('', '_blank', 'width=300,height=300');
          popupWin.document.open();
          popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
           popupWin.document.close();
               }
    </script>
  </head>
       <body >
               other contents
           <div id="divToPrint" >
              <div style="width:200px;height:300px;background-color:teal;">
                 This is the div to print
               </div>
           </div>
           <div>
               <input type="button" value="print" onclick="PrintDiv();" />
           </div>
       </body>
</html>

Perm Gens space in IntelijIDEA

go to  > Edit Configuration >

put this line into a vm parameter

-XX:MaxPermSize=128m -XX:PermSize=128m -Xms1024m -Xmx1024m -XX:-UseGCOverheadLimit

Monday, 2 January 2012

Rendering Div Using Ajax

you have to use remoteFunction and call it on any event and call action on the controller and when at the end of the action you have to render one template .

In controller

def sendMail={
   //sending mail code
   render(template:'renderingDiv',model:[Name:"any Bean"])
}
In  _renderingDiv.gsp
<div>
 //use Bean for data (any GSP code)
</div>


This div automatically Rendered to The remoteFunction calling page and added to the id
specified By update attribute in remoteFunction