|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: Reading and Saving homes on my web server using SweetHome3DApplet |
|
| Print at Dec 20, 2025, 4:54:53 PM | |
| Posted by marchenar at Sep 22, 2011, 10:11:31 PM |
|
Reading and Saving homes on my web server using SweetHome3DApplet Hello, first of all, the SweetHome3D is great!, so I want to thank you for this beatiful and useful software. I am interested to embed the SweetHome3DApplet in a GWT web application that calculate energy consumption based on the devices users define for their houses (today we use a very basic 2D design that we had developed, but I think SH3D would be great to replace our 2D editor), so I compiled my oun applet extending the SweetHome3DApplet to interact with my GWT application using the GWTAI library. I could show the SH3D editor inside my GWT application and invoke applet methods, but I have the problem that I didn't find the way to read and write home files located on my web server. Reading the API documentation I found that from HomeController the list of homes could be managed, but is it possible to open and save specific files without using the list?, that is files that exist in the web server. On the other hand, looking at the SweetHome3D online source code, I've seen that you use listHomes.jsp, readHome.jsp, writeHome.jsp, readPreferences.jsp, and writePreferences.jsp as parameters for the SweetHome3DApplet, and I found a link to download php version of the first 3 files. Could you share the jsp version of these files? Also, I tried to use the defaultHome parameter of the SweetHome3DApplet but it didn't work, have you any example of how to use it? Thank you in advance, and sorry for my bad English... Roberto |
| Posted by Puybaret at Sep 23, 2011, 10:23:31 AM |
|
Re: Reading and Saving homes on my web server using SweetHome3DApplet Welcome to Sweet Home 3D developers community. I hope you'll give us a chance to try your software (if you can open source it of course). Sorry if the description of the parameters of SweetHome3DApplet class isn't clear enough. I tried to make logical choices according to the values you give to readHomeURL, writeHomeURL, listHomesURL and defaultHome parameters, and here are the most typical cases I can think about. First their default values defined as follows: readHomeURL="readHome.php?home=%s",Then, the parameters defined as follows: readHomeURL="%s",If you want to let the end user save his changes, but still not let him create a new home from the applet, then you'll have to define writeHomeURL service, for example: readHomeURL="readHome.php?home=%s",If you want to let the end user open any home but never save his changes, the parameters could be as follows: readHomeURL="%s",On the other hand, looking at the SweetHome3D online source code, I've seen that you use listHomes.jsp, readHome.jsp, writeHome.jsp, readPreferences.jsp, and writePreferences.jsp as parameters for the SweetHome3DApplet, and I found a link to download php version of the first 3 files. Could you share the jsp version of these files? I won't give you here the exact source code of the JSP pages I use, because it's valuable only in the context of sweethome3d.com where some data is stored in a database and an identification is required to open/save the homes of a user. So I prefer to give here translations of the existing php files that work on files local to the JSP pages and let you adapt them for your needs.<%-- listHomes.jsp <%-- writeHome.jsp <%-- readHome.jsp <%-- writePreferences.jsp <%-- readPreferences.jspHope this will be useful. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by marchenar at Sep 23, 2011, 11:31:22 AM |
|
Re: Reading and Saving homes on my web server using SweetHome3DApplet Thank you very much Emmanuel for you fast response, this information is very useful to me. Soon, when I had finish the prototype that I am writing now to check the integration with GWT libraries, I will share here in the forum the additions I did to the SweetHome3DApplet source files to embed the applet into a GWT application, and some fragments of code of the GWT application. Also, when the new version of our appliation will be online I will send you a link to our application, so you could check how we use Sweet Home 3D inside our project. Have a nice weekend, Roberto |
|
|
Current timezone is GMT Dec 20, 2025, 4:54:53 PM |