MarvinSketch in JSP

User b0f6d33590

10-11-2008 10:29:48

Hi Marvin Users





I am quite new to Marvin and have an easy question:





I would like to embed Marvon Sketch into my Web Application (JSP). I would like to do this in 2 diffrent ways:





1. I would like to provide a defined area in the web app. The users can double click with the mouse and the application marvin sketch will be started. The user then will edit the structure and after closing the marvin sketch application, the edited structure will appear in the defined area.








2. I would like to include the marvin applet directly into the JSP page.








Could anyone help me to fulfill this two taks in a very easy way. What is needed inside the JSP? Are there any documentation about the things I would like to do?





Many thanks in advance





David

ChemAxon 7c2d26e5cf

10-11-2008 10:49:21

Please see the following example. I think it is very close to your first scenario.


MarvinSketch Example - Pure visualization mode, detaching MarvinSketch from the web page





Answering your second question: Actually, you can use any MarvinSketch applet example in your JSP (just copy the proper part of the html there). Examples are encountered on this page: MarvinSketch Applet Examples


The first is the simplest one, it shows how to insert applet into a web page. If you review also the others, you can learn how to set a molecule for the applet or retrieve drawn compound from there.

User b0f6d33590

10-11-2008 13:04:25

Hi Tamas





Thx for the quick reply. I have now succesfully integrated marvin sketch within my application.





But now I have still another question: Is there a possiblity to call a javascript function in my web app when the content has changed?





If I have the following code and would like to call a java script function whenever the content changes, how can I do this?





<script LANGUAGE="JavaScript1.1">


<!--


msketch_begin("../../marvin", 300, 200);


msketch_param("autoScale", "true");


msketch_param("detach", "hide");


msketch_param("undetachByX","false");


msketch_param("menubar", "true");


msketch_param("reactionErrorVisible", "false");


msketch_param("isMyTemplatesEnabled", "true");


msketch_end();


//-->


</script>

User b0f6d33590

10-11-2008 15:07:25

Hi again





I have found out that there are two possibilities: molLoaderFinishedEvent and listenpropertychange. The listenpropertychange is working in my environment. But the molLoaderFinishedEvent will never occure. I have used the code below. Any ideas?





msketch_mayscript=true;


msketch_begin("../../marvin", 300, 200);


msketch_param("autoScale", "true");


msketch_param("detach", "hide");


msketch_param("undetachByX","false");


msketch_param("menubar", "true");


msketch_param("reactionErrorVisible", "false");


msketch_param("isMyTemplatesEnabled", "true");


//msketch_param("listenpropertychange","true");


msketch_param("molLoaderFinishedEvent", "js:alert('Hello World')");


msketch_end();

ChemAxon 7c2d26e5cf

11-11-2008 14:10:17

Please do not use both molLoaderFinishedEvent and listenpropertychange in the same time. Actually the second one is the extention of the previous one.


Example for molLoaderFinishedEvent:


http://www.chemaxon.com/test/example-molLoaderFinishedEvent.html


Example for listenpropertychange:


http://www.chemaxon.com/test/example-propertychange.html