Monday, April 23, 2012

JQuery: parse json text to json Object


var obj = jQuery.parseJSON('{"name":"John"}');
alert( obj.name === "John" );


Reference:
http://api.jquery.com/jQuery.parseJSON/

GSON: map to json string simple example


import com.google.gson.Gson;
...
...
Map<String,Object> modelMap = new HashMap<String,Object>();
modelMap.put("message", "welcome");
modelMap.put("success", false);
modelMap.put("data", new Object());                                    


Gson gson = new Gson();
String jsonOutput = gson.toJson(modelMap); // {"message":"welcome","data":{},"success":false}


Resources:
http://blog.pontt.com/json-con-java/introduccion-java-y-json-primera-parte-con-ejemplo/
http://code.google.com/p/google-gson/

Friday, April 20, 2012

ExtJS4: get values from ExtJS form

Use the form.getValues() Method:

var  myFormPanelObj  = Ext.getCmp("myFormPanelId");
var data  =   myFormPanelObj.getForm().getValues();  
console.log("data: " + Ext.JSON.encode(data)); // {field1name : "field1value" , field2name : "field2value"}

References:
http://www.sencha.com/forum/showthread.php?62958-ExtJs-Jquery-form-submit

Thursday, April 19, 2012

Spring 3.0 - Ajax Handling Example

Finally I found a Simple and Fully functional sample of a proyect ussing the spring framework and the Ajax Technology. It's a Netbeans Project. There is the explained code and you can download the project sources.

http://cmop17.wordpress.com/2010/12/17/spring-usando-ajax-con-jquery-post-and-get/


Wednesday, March 14, 2012

ExtJS 4: Uncaught Ext.Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class:

if you get the error:

Uncaught Ext.Error: Ext.Loader is not enabled, so dependencies cannot be resolved dynamically. Missing required class: SIBismark.view.Viewport


Add the following line at the beginning of your js file

Ext.Loader.setConfig({enabled:true});


In Example in the app.js :



Ext.Loader.setConfig({enabled:true});
Ext.application({
    name: 'SI'
    ,requires:['SI.view.Viewport']
    ,autoCreateViewport: true
    ,launch: function() {        
        // This is fired as soon as the page is ready
    }
}); 


Reference:
http://www.sencha.com/learn/architecting-your-app-in-ext-js-4-part-3/

Tuesday, March 6, 2012

Configuring Netbeans Java Project with IBM WebSphere MQ Libs

1. Download and Install IBM MQ (http://www-01.ibm.com/software/integration/wmq/)
In NetBeans,
2. Create a Java Application Project.
3. go to Tools > Librarias option
4. Create a new Library
5. Click the "Add Jar/Folder" Button and select all the jars present in the route: mq_installation_dir\java\lib
6. Click "ok" button
7. Go to YourProject > Libraries, right click and "Add Library"
8. Select the library that you have just created
9. Click the  "Add Library" button