Java Applet aColoring V 1.00

aColoring presentation




In this sample you can see the use of the "Save" option by using a form and the javabeans JSP jspImage (it is possible to replace it by the ASP component acxImage for IIS servers). For it we use a Java => javascript communication (class JSobject).
It is also possible to save the data without java <-> javascript communication (the applet Java can directly send data with a "POST").

Sample JSP code to save the image :
<jsp:useBean id="zz" scope="session" class="javaside.Rbl14.jspImage" /><%
     int    iW, iH ;	// Taille de l image a generer 
     String sFormat;	// Format jpeg or png) 
     String sData ;	// Data 

       sFormat = "jpeg" ; 
       sData = request.getParameter("data") ; 

       String t = null ; 
       t = request.getParameter("w") ; 
       if (t == null) 
        iW = 380 ; 
       else
        iW = java.lang.Integer.parseInt(t) ; 

       t = request.getParameter("h") ; 
       if (t == null) 
        iH = 300 ; 
       else
        iH = java.lang.Integer.parseInt(t) ; 

      // Initialisation et definition de la taille de l image
        zz.init(iW, iH) ; 
        zz.readData( sData ) ; 

        zz.loadImage( "/monsite/img/flower1.gif" , 0 ) ;
        zz.loadImage( "/monsite/img/flower2.gif" , 1 ) ;

        zz.build() ; 

        response.reset(); 
        response.setContentType("image/" + sFormat ); 
        response.addHeader("Content-Disposition","filename=jspImage." + sFormat); 

        zz.encode( response, sFormat ) ;
        response.flushBuffer(); 

        zz.clear() ; 
 %>

Copyright © 1996..2003, BERTHOU. All right reserved.
Last change : 04 March 2003 18H16