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>
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>