passing marvin sketch structure from one JSP page to another

User 08026ff1f0

01-11-2004 20:31:49

Hi,





I have written the following code for passing a structure from one JSP page ..to another..





<html>


<head>


<%@page import="chemaxon.util.*,chemaxon.descriptors.*,chemaxon.jchem.db.*"%>


<script LANGUAGE="JavaScript1.1" SRC="/jchem/marvin/marvin.js"></script>


<script LANGUAGE="JavaScript1.1">


<!--





function submit()


{





form=document.queryForm;


form.action="retmsketch1.jsp" + location.search;


form.molfile.value=document.msketch.getMol('mol');


form.submit();


}





//-->


</script>





</head>


<body bgcolor=#e1e1e1>


<form name="queryForm" method="post" onSubmit="submit()">


<input type="hidden" name="molfile">


<script LANGUAGE="JavaScript1.1" SRC="/jchem/marvin/marvin.js"></script>





<script LANGUAGE="JavaScript1.1">


<!--


msketch_name="msketch";


msketch_begin("/jchem/marvin", 460, 380);


msketch_param("background", "#ffffff");


msketch_param("molbg", "#ffffff");





msketch_param("preload","MolExport,GraphInvariants,Parity");


msketch_end();


//-->


</script>





<br>


<input type="submit" name="submit" value="submit">


</form>


</body>


</html>





and in the other JSP page first I am just trying to see all the cd_id s that match the structure ..So i am just trying to print all the cd_id s returned by the searcher. But irrespective of the structure that i draw in the marvin sketch it is displaying all the compound ids.So i think that there is some thing wrong in the passing the structure from one page to another..Please help me in finding out the problem.





For retreving the cd_id s i used the fiollowing code :








<html>


<body>


<%


String molfile = (String)request.getParameter("molfile");


System.out.println(molfile);


if(molfile != null)


{


try{


ConnectionHandler ch = new ConnectionHandler();


ch.setDriver("oracle.jdbc.driver.OracleDriver");


ch.setUrl("jdbc:oracle:thin:@//localhost:1521/test");


ch.setLoginName("system");


ch.setPassword("bhargav");


ch.connect();


String structureTableName = "jchemstrucure";


JChemSearch searcher = new JChemSearch(); // Create searcher object


searcher.setQueryStructure(molfile);


searcher.setConnectionHandler(ch);


searcher.setStructureTable(structureTableName);


searcher.setWaitingForResult(true);


searcher.setSearchType(JChemSearch.SUBSTRUCTURE);


searcher.run();





int cd[]=searcher.getResults();





for(int i=0 ;i< cd.length ;i++)


out.println(cd);





}








catch(SQLException e){


out.println("database access error");


}





}





else{ out.println("Empty Query");}


%>





</body>


</html>

ChemAxon 9c0afc9aaf

01-11-2004 21:20:41

Try to remove the "onSubmit()" tag from this line:





Code:
<form name="queryForm" method="post" onSubmit="submit()">






Probably "submit()" is also a reserved method in JavaScript, please rename that function and call from the "onClick" property of a button.


Alternatively you may use "href" to call Javascript if the button is a picture:





Code:
href="javascript:mySubmit()"

User 08026ff1f0

03-11-2004 19:50:34

Hi,





thanks . I could figure out the problem. Its working now. But there is a problem.When i am trying to display more number of compound structures in one page the page is crashing and all the browser windows are geting closed.I think its due to the more number of structures that are being displayed and less memory,How can the page be avoided from crashing?How can i display structures in a number of pages instead of only one?





Bhargav

ChemAxon 9c0afc9aaf

04-11-2004 12:07:20

Hi,





Probably you are trying to display the structures in separate applets ?


You should use a molecule table with one mview.


See:





http://www.chemaxon.com/marvin/doc/dev/example-view2.1.html





If the number of compounds is too great for one molecule table, then you should code some


paging into your application.


You should keep the hit list, the current page and similar data in session variables, when implementing paging.





Please see the source code of out JSP example in the JChem package under:





<jchem>/examples/jsp1_x/





We are planning to also include a much simpler example in the future.

User 08026ff1f0

05-11-2004 19:13:50

Hi





I have seen the example page but i am not able to figure out how to implement paging.Can you tell me in detail how to implement paging.Thanks








Bhargav

ChemAxon 43e6884a7a

06-11-2004 15:50:05

The details are in the example.