using the .mole file generated from Marvin applet.

User 862a6449fe

18-04-2005 21:06:43

Hello !





I would like to use (on the server side) the structure write with the Marvin applet. Till now I am using the smile string and I write it into a cookie, but now I would like to use the .mol file which could be to large to be storred into a cookie.


Is it possible to write the file from the applet on the client side, or does I have to use the session to transfert the information ?





Thanks for your comments,


Jean-Marie

ChemAxon 7c2d26e5cf

19-04-2005 10:25:06

You can send a structure as string from a Marvin applet to the server.


To do this, firstly, you need some JavaScript code to get the molecule from the applet.


The following example demonstrates the using of JMSketch.getMol(String).


http://www.chemaxon.com/marvin/doc/dev/example-sketch3.4.html


Then, a form field has to be set to the returning value of the getMol method. By submitting this form, the mol string will be posted to the web server.


The following example demonstrates how to post structure to a JSP: http://www.chemaxon.com/marvin/doc/dev/example-noliveconnect1.html





MarvinSketch applet can not write to the server. It can save file only to the local machine (by using of "Save" or "Save As" option in the "File" menu of MarvinSketch).


If you want to upload a structure to the server, you need some http programming:


Code:
<form NAME="fileform" ENCTYPE="multipart/form-data" ACTION="molfilehandler.jsp" METHOD="post" VALUE="">


    <input TYPE="FILE" SIZE="30" NAME="molfile">


    <input TYPE="SUBMIT" VALUE="Submit">


</form>



The above form provides a "Browse" and a submit button. By selecting the "Browse" button a "File Upload" dialog will display. After selecting the required file and clicking on "Open" button, the content of the file will be inserted into the form. If you click on the "Submit" button, the form will be posted to those JSP which is specified in the ACTION attribute. On server side, instead of JSP, you can use also CGI, PHP to process the request.

User 1cab753e44

16-01-2008 14:00:02

Tamas wrote:
You can send a structure as string from a Marvin applet to the server.


To do this, firstly, you need some JavaScript code to get the molecule from the applet.


The following example demonstrates the using of JMSketch.getMol(String).


http://www.chemaxon.com/marvin/doc/dev/example-sketch3.4.html


Then, a form field has to be set to the returning value of the getMol method. By submitting this form, the mol string will be posted to the web server.


The following example demonstrates how to post structure to a JSP: http://www.chemaxon.com/marvin/doc/dev/example-noliveconnect1.html


This is precisely what I am attempting to do right now. I want to send the structure drawn in Marvin to the server as an sd file.


I call MSketch.getMol('sdf') and I get a String that "looks like" an sd file on the other end at the server. When attempting to anything with it on the server side, I get errors:


chemaxon.struc.Molecule drawnMolecule = MolImporter.importMol(stringRepresentationOfFile);





The MolImporter does not recognize the file format...





chemaxon.formats.MolFormatException: java.io.IOException: file format not recognized


at chemaxon.formats.MolImporter.toMolFormatException(MolImporter.java:858)


at chemaxon.formats.MolImporter.importMol(MolImporter.java:816)


at chemaxon.formats.MolImporter.importMol(MolImporter.java:871)








Interestingly, if I substitute MSketch.getMol('sdf') with MSketch.getMol('mrv') things work fine...





Marvin version: 4.0.3

ChemAxon 7c2d26e5cf

16-01-2008 15:10:25

4.0.3 is an ancient version of Marvin (November 10, 2005). There are a lot of bugfix an new feature since then.


I recommend you to upgrade your Marvin to a newer version.