[SOLVED] save/load ggb-files from mysql database

ilkkak shared this question 9 years ago
Answered

Is it possible to load/save ggb-files directly to mysql database?

Comments (5)

photo
1

Hi,


it's possible using a server-side language like PHP or JSP and GeoGebra's JavaScript API if you're talking about a website or you can embed GeoGebra in an additional Java application and use Java's database capabilities. For loading (on a website) you just need a server-side language (no JavaScript), you can generate the HTML code for the applet, including the file itself, dynamically using base64 encoding.


cheers,

Florian

photo
1

I use tomcat6 environment to deploy servlet application. Could you give me more detailed examples or hints. I'm an experienced java programmer but geogebra is new to me.The purpose of my work is to embed geogebra to the existing three fold application.


I'm collecting open teaching material (like wikibook), mainly for physics, and geogebra would be one excellent opportunity to enlarge tool to do that.

photo
1

Do ctrl-shift-M and have a look at what's put on the clipboard - that's all you need to include in the webpage.

photo
1

Hi,


how should people "save" their files? Should they upload a .ggb file or should they create their whole construction in the browser (using a GeoGebra applet) and click on a "save" button at the end?


If you go the uploading route you'll have to base64-encode the contents of your file before saving it into your database. As you are working in Java you can probably even use GeoGebra's own helper class for that.


If you go the applet route you have to use JavaScript to get the XML information of the GeoGebra construction. You can use the GeoGebra JavaScript API method getXML() for that. You can use AJAX or a hidden form to get the XML to the server-side where you have to base64-encode that string as well.


If your database contains the base64-encoded files the loading process is very simple using the base64-parameter of the GeoGebra applet tag: http://www.geogebra.org/en/...


Florian

photo
1

Do ctrl-shift-M and have a look at what's put on the clipboard - that's all you need to include in the webpage.


Thank! It solves the problem.

© 2020 International GeoGebra Institute