Monday, April 22, 2013

servlet to jsp using json (object passing)

jquery


$('.snd').click(function (){
    $.ajax({
        url: '/M08CDECUStructuralOptimiser/NodeAction?action=test',
        data: {cl1: $('.t11').val()},
        dataType: "json",
        success: function (response){
            alert(response[1]);
        }
    });
});



Servlet



if (action.compareTo("test") == 0) {
           
            String[] ss= {"n1","n2"};
            Form f1=new Form(1,2,3);
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try {

                Gson gson = new GsonBuilder().setPrettyPrinting().create();
                String json=gson.toJson(ss);
               
                out.println(json);
            } finally {
                out.close();
            }
        }

Friday, April 19, 2013

set conf file in linux

file name asenv.conf

add line

AS_JAVA="/home/szlynas/jdk1.6.0_45"

Thursday, April 18, 2013

run glassfish server on linux console command

./glassfish-3.1.2.2/bin/asadmin start-domain

Xampp setup in linux

This solution worked well for me: http://www.apachefriends.org/f/viewtopic.php?f=17&t=50902&p=196185#p196185
Edit /opt/lampp/etc/extra/httpd-xampp.conf and adding Require all granted line at bottom of block <Directory "/opt/lampp/phpmyadmin"> to have the following code:
<Directory "/opt/lampp/phpmyadmin">
  AllowOverride AuthConfig Limit
  Order allow,deny
  Allow from all
  Require all granted
</Directory> 
 


Extract the downloaded archive file to /opt: tar xvfz xampp-linux-1.8.1.tar.gz -C /opt


To start XAMPP simply call this command:
/opt/lampp/lampp start






# Close XAMPP sites here
<LocationMatch "^/(?i:(?:xampp|licenses|phpmyadmin|webalizer|server-status|server-info))">
    Order deny,allow
    Deny from all
    Allow from ::1 127.0.0.0/8 
    ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>