postgres jstl and marvin

User 138d6f42d5

25-03-2010 14:19:43

Hi;


I try to use smiles code generated by marvin sketch in jdbc postgres db consults.


Some very simples smiles can pass the process but when it has a backslash character I get errors.


I experiment change the javascript replace to change "\" to "\\" but in this case the applet don´t run. 


================code I changed=====================


function exportSmiles() {
                                        if(document.queryForm.MSketch != null) {
                                                var s = document.queryForm.MSketch.getMol('smiles');


                                                s = s.replace("\", "\\");
                                                s = unix2local(s); // Convert "\n" to local line separator
                                                document.queryForm.smiles.value = s;
                                        } else {
                                                alert("Cannot import molecule:\n"+
                                                      "no JavaScript to Java communication in your browser.\n");
                                        }
)


================================================


 

ChemAxon 990acf0dec

30-03-2010 15:39:22

Hi,


Sorry for the late respond here; we are still investigating this issue. Will come back with an answer soon.


Best regards,


Akos

ChemAxon 7c2d26e5cf

02-04-2010 16:08:16

Please see the following example.


https://www.chemaxon.com/marvin/examples/applets/sketch/js_io.html


It demonstrates how to retrieve structure from applet and how to import molecule stream (from a form) into applet.


In this case, you do not have to escape backslash characters.


Escaping backslash is important when smiles string is embedded explicitly into the html code. For example:


<script type="text/javascript">
msketch_begin("/marvin",400,400);
msketch_param("mol","ON\\C=C\\NCl");
msketch_end();
</script>

ChemAxon 7c2d26e5cf

02-04-2010 16:16:26

By the way, we plan to talk about character escaping, molecule stream embedding questions on the Developer Training of the European User Group Meeting (2010 European UGM: May 19-20, Budapest, Hungary).

User 138d6f42d5

05-04-2010 12:46:47

Hi Tamas;


The page related to the link can be used as example.


If I add a  line in the javascript function  exportMol


the applet don´t work properly.


In my case I tried to use   s = s.replace("\", "\\")


I need this second backslash for my jdbc querry work.


Jair


 














 


 


Tamas wrote:



Please see the following example.


https://www.chemaxon.com/marvin/examples/applets/sketch/js_io.html


It demonstrates how to retrieve structure from applet and how to import molecule stream (from a form) into applet.


In this case, you do not have to escape backslash characters.


Escaping backslash is important when smiles string is embedded explicitly into the html code. For example:


<script type="text/javascript">
msketch_begin("/marvin",400,400);
msketch_param("mol","ON\\C=C\\NCl");
msketch_end();
</script>


ChemAxon 7c2d26e5cf

08-04-2010 17:40:45

I recommend to do escaping of characters outside JavaScript, for example in JSP.


Please see the following topic. It shows how to escape molecule string before feed it with JavaScript.



MView works only with inline "mol" param (PC, fire