How could I access a form inside a window from another jsp

I have jsp in wich is created a grid, when a row is double clicked, a dhtml window with a form is created and then hide, the id of the row is then send throw a frame to another jsp that uses an oracle package and returns the information from the database to fill the form inside the windows and then show the window. I usually use parent.form.setItemValue, but since the form is inside the window it’s not working. How could I access a form inside a window from another jsp.

Example

a.jsp

            var grid1 = new dhtmlXGridObject('divGrid');
            grid1.setImagePath      ("../dhtmlx/codebaseGrid/imgs/");
            grid1.setSkin           (skin);
            grid1.enableEditEvents  (false,true,true);
            grid1.setHeader         ("1,2,3,4,5,6");
            grid1.enableResizing    ("false,false,false,false,false,false");
            grid1.enableTooltips    ("false,false,false,false,false,false");
            grid1.setInitWidths     ("70,220,100,100,0,50");
            grid1.setColAlign       ("center,center,center,center,center,center");
            grid1.setColTypes       ("ro,ro,ro,ro,ro,img");
            grid1.setColSorting     ("int,str,na,str,str,na")
            grid1.init();

            grid1.attachEvent("onRowDblClicked", function(rId,cInd)
            {

                    var dhxWins = new dhtmlXWindows();
                    dhxWins.enableAutoViewport(true);
                    dhxWins.setImagePath("../dhtmlx/codebaseWindow/imgs/");
                    dhxWins.setSkin(skin);
                    w2 = dhxWins.createWindow("w2", 250 ,200 , 500 ,200);
                    dhxWins.window("w2").denyResize();
                    dhxWins.window("w2").denyMove();
                    dhxWins.window("w2").button("park").hide();
                    dhxWins.window("w2").button("minmax1").hide();
                    dhxWins.window("w2").setText("..:: Example ::..");
                    var formAsunto = w2.attachForm(structure);
                    w2.hide();

                    id       =   grid1.cells(rId,4).getValue();
                    
                    var url= "b.jsp?id="+id;
                    window.frames.fsA.location=url;
                } 

b.jsp

String idrecep  =request.getParameter("id");
sql=" begin ? := PKG_PUNICO_WEB.getA(?); end;";	    
stmt = conn.prepareCall(sql);
stmt.registerOutParameter(1, OracleTypes.CURSOR);
stmt.setString(2, idrecep);
stmt.execute();
rs = (ResultSet)stmt.getObject(1);
while ( rs.next() )
{

    String AS  =  rs.getString("AS");   
 
%>
<script>
    
    try
    {
        
      
    parent.w2.show();                                                  //This Works
    alert("<%=AS%>");                                                     //This Works
    parent.formAsunto.setItemValue("asunto","<%=AS%>"); // This doesn't works
                                              
    
    }
    
    catch(e)
    {
        alert(e.getMessage())
    }
   
</script>
<% }

}
catch (Exception e)

              {
                    System.out.println(e.getMessage());
              }

hi

grid.attachEvent(…, function(){

var formAsunto = w2.attachForm(structure);
}

make “formAsunto” global, i.e.

var formAsunto;

grid.attachEvent(…, function(){

formAsunto = w2.attachForm(structure);
}