<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Loiane Groner</title>
	
	<link>http://loianegroner.com</link>
	<description>My development notes</description>
	<lastBuildDate>Thu, 02 Sep 2010 11:59:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/LoianeGroner" /><feedburner:info uri="loianegroner" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.0/</creativeCommons:license><feedburner:emailServiceId>LoianeGroner</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>ExtJS, Spring MVC 3 and Hibernate 3.5: CRUD DataGrid Example</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/y6hXX8mSgJI/</link>
		<comments>http://loianegroner.com/2010/09/extjs-spring-mvc-3-and-hibernate-3-5-crud-datagrid-example/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 10:30:27 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[CRUD Grid]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[ExtJS Grid]]></category>
		<category><![CDATA[hibernate 3]]></category>
		<category><![CDATA[hibernate annotations]]></category>
		<category><![CDATA[Spring 3]]></category>
		<category><![CDATA[Spring MVC]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=494</guid>
		<description><![CDATA[This tutorial will walk through how to implement a CRUD (Create, Read, Update, Delete) DataGrid using ExtJS, Spring MVC 3 and Hibernate 3.5. What do we usually want to do with data? Create (Insert) Read / Retrieve (Select) Update (Update) Delete / Destroy (Delete) Until ExtJS 3.0 we only could READ data using a dataGrid. [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/03/extjs_spring_crud_grid.png"><img class="aligncenter size-full wp-image-335" title="extjs_spring_crud_grid" src="http://loianegroner.com/wp-content/uploads/2010/03/extjs_spring_crud_grid.png" alt="" width="664" height="351" /></a></p>
<p style="text-align: justify;">This tutorial will walk through how to implement a CRUD (Create, Read, Update, Delete) DataGrid using ExtJS, Spring MVC 3 and Hibernate 3.5.</p>
<p style="text-align: justify;">What do we usually want to do with data?</p>
<ul style="text-align: justify;">
<li>Create      (Insert)</li>
<li>Read      / Retrieve (Select)</li>
<li>Update      (Update)</li>
<li>Delete      / Destroy (Delete)</li>
</ul>
<p style="text-align: justify;">Until ExtJS 3.0 we only could READ data using a dataGrid. If you wanted to update, insert or delete, you had to do some code to make these actions work. Now ExtJS 3.0 (and newest versions) introduces the ext.data.writer, and you do not need all that work to have a CRUD Grid.</p>
<p style="text-align: justify;">So… What do I need to add in my code to make all these things working together?</p>
<p style="text-align: justify;">In this example, I’m going to use JSON as data format exchange between the browser and the server.</p>
<h3 style="text-align: justify;">ExtJS Code</h3>
<p style="text-align: justify;">First, you need an Ext.data.JsonWriter:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
 // The new DataWriter component.
    var writer = new Ext.data.JsonWriter({
        encode: true,
        writeAllFields: true
    });
</pre>
<p>Where writeAllFields identifies that we want to write all the fields from the record to the database. If you have a fancy ORM then maybe you can set this to false. In this example, I&#8217;m using Hibernate, and we have saveOrUpate method &#8211; in this case, we need all fields to updated the object in database, so we have to ser writeAllFields to true. This is my record type declaration:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var Contact = Ext.data.Record.create([
	{name: 'id'},
    {
        name: 'name',
        type: 'string'
    }, {
        name: 'phone',
        type: 'string'
    }, {
        name: 'email',
        type: 'string'
    }]);
</pre>
<p style="text-align: justify;">Now you need to setup a proxy like this one:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var proxy = new Ext.data.HttpProxy({
        api: {
            read : 'contact/view.action',
            create : 'contact/create.action',
            update: 'contact/update.action',
            destroy: 'contact/delete.action'
        }
    });
</pre>
<p>FYI, this is how my reader looks like:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var reader = new Ext.data.JsonReader({
        totalProperty: 'total',
        successProperty: 'success',
        idProperty: 'id',
        root: 'data',
        messageProperty: 'message'  // &lt;-- New &quot;messageProperty&quot; meta-data
    },
    Contact);
</pre>
<p>The Writer and the proxy (and the reader) can be hooked to the store like this:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
 // Typical Store collecting the Proxy, Reader and Writer together.
    var store = new Ext.data.Store({
        id: 'user',
        proxy: proxy,
        reader: reader,
        writer: writer,  // &lt;-- plug a DataWriter into the store just as you would a Reader
        autoSave: false // &lt;-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
    });
</pre>
<p style="text-align: justify;">Where autosave identifies if you want the data in automatically saving mode (you do not need a save button, the app will send the actions automatically to the server). In this case, I implemented a save button, so every record with new or updated value will have a red  mark on the cell left up corner).  When the user alters a value in the grid, then a &#8220;save&#8221; event occurs (if autosave is true). Upon the &#8220;save&#8221; event the grid determines which cells has been altered. When we have an altered cell, then the corresponding record is sent to the server with the &#8216;root&#8217; from the reader around it. E.g if we read with root &#8220;data&#8221;, then we send back with root &#8220;data&#8221;. We can have several records being sent at once. When updating to the server (e.g multiple edits).  And to make you life even easier, let’s use the RowEditor plugin, so you can easily edit or add new records. All you have to do is to add the css and js files in your page:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;!-- Row Editor plugin css --&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-crud-grid/ext-3.1.1/examples/ux/css/rowEditorCustom.css&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-crud-grid/ext-3.1.1/examples/shared/examples.css&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-crud-grid/ext-3.1.1/examples/ux/css/RowEditor.css&quot; /&gt;

&lt;!-- Row Editor plugin js --&gt;
	&lt;script src=&quot;/extjs-crud-grid/ext-3.1.1/examples/ux/RowEditor.js&quot;&gt;&lt;/script&gt;
</pre>
<p>Add the plugin on you grid declaration:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var editor = new Ext.ux.grid.RowEditor({
        saveText: 'Update'
    });

    // create grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        columns: [
            {header: &quot;NAME&quot;,
             width: 170,
             sortable: true,
             dataIndex: 'name',
             editor: {
                xtype: 'textfield',
                allowBlank: false
            }},
            {header: &quot;PHONE #&quot;,
             width: 150,
             sortable: true,
             dataIndex: 'phone',
             editor: {
                 xtype: 'textfield',
                 allowBlank: false
            }},
            {header: &quot;EMAIL&quot;,
             width: 150,
             sortable: true,
             dataIndex: 'email',
             editor: {
                xtype: 'textfield',
                allowBlank: false
            }})}
        ],
        plugins: [editor],
        title: 'My Contacts',
        height: 300,
        width:610,
		frame:true,
		tbar: [{
            iconCls: 'icon-user-add',
            text: 'Add Contact',
            handler: function(){
                var e = new Contact({
                    name: 'New Guy',
                    phone: '(000) 000-0000',
                    email: 'new@loianetest.com'
                });
                editor.stopEditing();
                store.insert(0, e);
                grid.getView().refresh();
                grid.getSelectionModel().selectRow(0);
                editor.startEditing(0);
            }
        },{
            iconCls: 'icon-user-delete',
            text: 'Remove Contact',
            handler: function(){
                editor.stopEditing();
                var s = grid.getSelectionModel().getSelections();
                for(var i = 0, r; r = s[i]; i++){
                    store.remove(r);
                }
            }
        },{
            iconCls: 'icon-user-save',
            text: 'Save All Modifications',
            handler: function(){
                store.save();
            }
        }]
    });
</pre>
<h3>Java code</h3>
<p>Finally, you need some server side code.</p>
<h4>Controller:</h4>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.web;

@Controller
public class ContactController  {

	private ContactService contactService;

	@RequestMapping(value=&quot;/contact/view.action&quot;)
	public @ResponseBody Map&lt;String,? extends Object&gt; view() throws Exception {

		try{

			List&lt;Contact&gt; contacts = contactService.getContactList();

			return getMap(contacts);

		} catch (Exception e) {

			return getModelMapError(&quot;Error retrieving Contacts from database.&quot;);
		}
	}

	@RequestMapping(value=&quot;/contact/create.action&quot;)
	public @ResponseBody Map&lt;String,? extends Object&gt; create(@RequestParam Object data) throws Exception {

		try{

			List&lt;Contact&gt; contacts = contactService.create(data);

			return getMap(contacts);

		} catch (Exception e) {

			return getModelMapError(&quot;Error trying to create contact.&quot;);
		}
	}

	@RequestMapping(value=&quot;/contact/update.action&quot;)
	public @ResponseBody Map&lt;String,? extends Object&gt; update(@RequestParam Object data) throws Exception {
		try{

			List&lt;Contact&gt; contacts = contactService.update(data);

			return getMap(contacts);

		} catch (Exception e) {

			return getModelMapError(&quot;Error trying to update contact.&quot;);
		}
	}

	@RequestMapping(value=&quot;/contact/delete.action&quot;)
	public @ResponseBody Map&lt;String,? extends Object&gt; delete(@RequestParam Object data) throws Exception {

		try{

			contactService.delete(data);

			Map&lt;String,Object&gt; modelMap = new HashMap&lt;String,Object&gt;(3);
			modelMap.put(&quot;success&quot;, true);

			return modelMap;

		} catch (Exception e) {

			return getModelMapError(&quot;Error trying to delete contact.&quot;);
		}
	}

	private Map&lt;String,Object&gt; getMap(List&lt;Contact&gt; contacts){

		Map&lt;String,Object&gt; modelMap = new HashMap&lt;String,Object&gt;(3);
		modelMap.put(&quot;total&quot;, contacts.size());
		modelMap.put(&quot;data&quot;, contacts);
		modelMap.put(&quot;success&quot;, true);

		return modelMap;
	}

	private Map&lt;String,Object&gt; getModelMapError(String msg){

		Map&lt;String,Object&gt; modelMap = new HashMap&lt;String,Object&gt;(2);
		modelMap.put(&quot;message&quot;, msg);
		modelMap.put(&quot;success&quot;, false);

		return modelMap;
	}

	@Autowired
	public void setContactService(ContactService contactService) {
		this.contactService = contactService;
	}

}
</pre>
<p>Some observations:</p>
<p style="text-align: justify;">In Spring 3, we can get the objects from requests directly in the method parameters using @RequestParam. I don&#8217;t know why, but it did not work with ExtJS. I had to leave as an Object and to the JSON-Object parser myself. That is why I&#8217;m using a Util class &#8211; to parser the object from request into my POJO class. If you know how I can replace Object parameter from controller methods, please, leave a comment, because I&#8217;d really like to know that! <img src='http://loianegroner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>Service Class:</h4>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.service;

@Service
public class ContactService {

	private ContactDAO contactDAO;
	private Util util;

	@Transactional(readOnly=true)
	public List&lt;Contact&gt; getContactList(){

		return contactDAO.getContacts();
	}

	@Transactional
	public List&lt;Contact&gt; create(Object data){

        List&lt;Contact&gt; newContacts = new ArrayList&lt;Contact&gt;();

		List&lt;Contact&gt; list = util.getContactsFromRequest(data);

		for (Contact contact : list){
			newContacts.add(contactDAO.saveContact(contact));
		}

		return newContacts;
	}

	@Transactional
	public List&lt;Contact&gt; update(Object data){

		List&lt;Contact&gt; returnContacts = new ArrayList&lt;Contact&gt;();

		List&lt;Contact&gt; updatedContacts = util.getContactsFromRequest(data);

		for (Contact contact : updatedContacts){
			returnContacts.add(contactDAO.saveContact(contact));
		}

		return returnContacts;
	}

	@Transactional
	public void delete(Object data){

		//it is an array - have to cast to array object
		if (data.toString().indexOf('[') &gt; -1){

			List&lt;Integer&gt; deleteContacts = util.getListIdFromJSON(data);

			for (Integer id : deleteContacts){
				contactDAO.deleteContact(id);
			}

		} else { //it is only one object - cast to object/bean

			Integer id = Integer.parseInt(data.toString());

			contactDAO.deleteContact(id);
		}
	}

	@Autowired
	public void setContactDAO(ContactDAO contactDAO) {
		this.contactDAO = contactDAO;
	}

	@Autowired
	public void setUtil(Util util) {
		this.util = util;
	}
}
</pre>
<h4>Contact Calss &#8211; POJO:</h4>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.model;

@JsonAutoDetect
@Entity
@Table(name=&quot;CONTACT&quot;)
public class Contact {

	private int id;
	private String name;
	private String phone;
	private String email;

	@Id
	@GeneratedValue
	@Column(name=&quot;CONTACT_ID&quot;)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name=&quot;CONTACT_NAME&quot;, nullable=false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name=&quot;CONTACT_PHONE&quot;, nullable=false)
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name=&quot;CONTACT_EMAIL&quot;, nullable=false)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
}
</pre>
<h4>DAO Class:</h4>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.dao;

@Repository
public class ContactDAO implements IContactDAO{

	private HibernateTemplate hibernateTemplate;

	@Autowired
	public void setSessionFactory(SessionFactory sessionFactory) {
		hibernateTemplate = new HibernateTemplate(sessionFactory);
	}

	@SuppressWarnings(&quot;unchecked&quot;)
	@Override
	public List&lt;Contact&gt; getContacts() {
		return hibernateTemplate.find(&quot;from Contact&quot;);
	}

	@Override
	public void deleteContact(int id){
		Object record = hibernateTemplate.load(Contact.class, id);
		hibernateTemplate.delete(record);
	}

	@Override
	public Contact saveContact(Contact contact){
		hibernateTemplate.saveOrUpdate(contact);
		return contact;
	}
}
</pre>
<h4>Util Class:</h4>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.util;

@Component
public class Util {

	public List&lt;Contact&gt; getContactsFromRequest(Object data){

		List&lt;Contact&gt; list;

		//it is an array - have to cast to array object
		if (data.toString().indexOf('[') &gt; -1){

			list = getListContactsFromJSON(data);

		} else { //it is only one object - cast to object/bean

			Contact contact = getContactFromJSON(data);

			list = new ArrayList&lt;Contact&gt;();
			list.add(contact);
		}

		return list;
	}

	private Contact getContactFromJSON(Object data){
		JSONObject jsonObject = JSONObject.fromObject(data);
		Contact newContact = (Contact) JSONObject.toBean(jsonObject, Contact.class);
		return newContact;
	}
)
	private List&lt;Contact&gt; getListContactsFromJSON(Object data){
		JSONArray jsonArray = JSONArray.fromObject(data);
		List&lt;Contact&gt; newContacts = (List&lt;Contact&gt;) JSONArray.toCollection(jsonArray,Contact.class);
		return newContacts;
	}

	public List&lt;Integer&gt; getListIdFromJSON(Object data){
		JSONArray jsonArray = JSONArray.fromObject(data);
		List&lt;Integer&gt; idContacts = (List&lt;Integer&gt;) JSONArray.toCollection(jsonArray,Integer.class);
		return idContacts;
	}
}
</pre>
<p>If you want to see all the code (complete project will all the necessary files to run this app), download it from my GitHub repository: <a href="http://github.com/loiane/extjs-crud-grid-spring-hibernate" target="_blank">http://github.com/loiane/extjs-crud-grid-spring-hibernate</a></p>
<p>This was a requested post. I&#8217;ve got a lot of comments from my<a href="http://loianegroner.com/2010/03/extjs-and-spring-mvc-framework-crud-datagrid-example/" target="_blank"> previous CRUD Grid example</a> and some emails. I made some adjustments to current code, but the idea is still the same. I hope I was able answer all the questions. <img src='http://loianegroner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=494&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=y6hXX8mSgJI:uiX5wstIauA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=y6hXX8mSgJI:uiX5wstIauA:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=y6hXX8mSgJI:uiX5wstIauA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=y6hXX8mSgJI:uiX5wstIauA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=y6hXX8mSgJI:uiX5wstIauA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=y6hXX8mSgJI:uiX5wstIauA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=y6hXX8mSgJI:uiX5wstIauA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=y6hXX8mSgJI:uiX5wstIauA:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/y6hXX8mSgJI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/09/extjs-spring-mvc-3-and-hibernate-3-5-crud-datagrid-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/09/extjs-spring-mvc-3-and-hibernate-3-5-crud-datagrid-example/</feedburner:origLink></item>
		<item>
		<title>How to resize an ExtJS Panel, Grid, Component on Window Resize without using Ext.Viewport</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/lxrJKfxhxdc/</link>
		<comments>http://loianegroner.com/2010/08/how-to-resize-an-extjs-panel-grid-component-on-window-resize-without-using-ext-viewport/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 10:30:56 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Ext.Viewport]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=483</guid>
		<description><![CDATA[This post will walk through how to resize an ExtJS Panel, Grid, Component on Window Resize without using Ext.Viewport. Problem: You have a legacy page and you want to change an html grid for an ExtJS DataGrid, because it has so many cool features. Or you have a page with some design and you are [...]]]></description>
			<content:encoded><![CDATA[
<p>This post will walk through how to resize an ExtJS Panel, Grid, Component on Window Resize without using Ext.Viewport.</p>
<p style="text-align: center;"><a title="How to resize an ExtJS Panel, Grid, Component on Window Resize without using Ext.Viewport" href="http://loianegroner.com/wp-content/uploads/2010/08/extjs-fit-to-parent_loiane_01.jpg" target="_blank"><img class="aligncenter size-full wp-image-491" title="extjs-fit-to-parent_loiane_01" src="http://loianegroner.com/wp-content/uploads/2010/08/extjs-fit-to-parent_loiane_01.jpg" alt="How to resize an ExtJS Panel, Grid, Component on Window Resize without using Ext.Viewport" width="491" height="419" /></a></p>
<p style="text-align: center;">
<h3>Problem:</h3>
<p style="text-align: justify;">You have a legacy page and you want to change an html grid for an ExtJS DataGrid, because it has so many cool features. Or you have a page with some design and you are going to use only one ExtJS Component. In both cases, you also want to render your ExtJS Component to a specific DIV. Also, you want you component to be resized in case you resize the browser window.</p>
<p style="text-align: justify;">How can you do that if resize a single component in an HTML page it is not the default behavior of an ExtJS Component (except if you use Ext.Viewport)?</p>
<h3 style="text-align: justify;">Solution:</h3>
<p style="text-align: justify;"><strong><em>Condor </em></strong>(from <a href="http://www.sencha.com/forum/member.php?343-Condor" target="_blank"><strong>ExtJS </strong></a><a href="http://www.sencha.com/forum/member.php?343-Condor" target="_blank"><strong>Community Support Team</strong></a>) developed a plugin that can do that for you.</p>
<p style="text-align: justify;">I had to spend some time to understand how the plugin works, and I finally got it working as I wanted.</p>
<p style="text-align: justify;">Well, I recommend you to spend some time reading this thread: <a href="http://www.sencha.com/forum/showthread.php?28318" target="_blank">http://www.sencha.com/forum/showthread.php?28318</a> (if you have any issues or questions, please publish it on the thread, so other members can give you the support you need).</p>
<h3>Requirements to make the plugin work:</h3>
<p>Your have to apply the following style to the DIV (the width is up to you, the other styles are mandatory, otherwise it will not work):</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;div id=&quot;reportTabContent&quot; style=&quot;overflow: hidden; position:absolute; width:98%;&quot;&gt;&lt;/div&gt;
</pre>
<p style="text-align: justify;">If you have any border around your ExtJS component, you have to set a HEIGHT. And you will also have to set a height to your ExtJS component. In this case, autoHeight will not work. If you DO NOT have any border or other design on the ExtJS component side, you do not need to set height and you can use autoHeight. In my case, I put a border on the external DIV, so I have to set Height:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;div style=&quot;border:3px solid #000000; padding:1px; width:99%; height:500px;&quot;&gt;
</pre>
<p>HTML code (all DIVs):</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
				&lt;div style=&quot;border:3px solid #000000; padding:1px; width:99%; height:500px;&quot;&gt;
					&lt;table&gt;
					&lt;tr&gt;
					&lt;td style=&quot;overflow: hidden; width:100%;&quot;&gt;
						&lt;div id=&quot;reportTabContent&quot; style=&quot;overflow: hidden; position:absolute; width:98%;&quot;&gt;&lt;/div&gt;
					&lt;/td&gt;
					&lt;/tr&gt;
					&lt;/table&gt;
				&lt;/div&gt;
</pre>
<p>And you need to add the plugin to the component (In this case, I’m using an ExtJS DataGrid):</p>
<pre class="brush: jscript; collapse: false; first-line: 1; highlight: [20]; toolbar: true; wrap-lines: false;">
    var grid = new Ext.grid.GridPanel({
        store: store,
        columns: [
            {header: 'Company', width: 160, sortable: true, dataIndex: 'company'},
            {header: 'Price', width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
            {header: 'Change', width: 75, sortable: true, renderer: change, dataIndex: 'change'},
            {header: '% Change', width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
            {header: 'Last Updated', width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
        ],
        stripeRows: true,
        autoExpandColumn: 'company',
        height: 490,
        autoWidth:true,
        title: 'Array Grid',
        // config options for stateful behavior
        stateful: true,
        stateId: 'grid'
        ,viewConfig:{forceFit:true}
    	,renderTo: 'reportTabContent' // render the grid to the specified div in the page
    	,plugins: [new Ext.ux.FitToParent(&quot;reportTabContent&quot;)]
    });
</pre>
<p>And done! Now you can resize the browser and the component will resize itself!</p>
<p>I tested it on Firefox, Chrome and IE6.</p>
<p>You can download my sample project from my <strong>GitHub</strong>: <a href="http://github.com/loiane/extjs-fit-to-parent" target="_blank">http://github.com/loiane/extjs-fit-to-parent</a></p>
<p>PS.: If you want to use the <strong>full browser window</strong>, use a <strong>Viewport</strong>.</p>
<p>Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=483&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=lxrJKfxhxdc:cGdxeQzJ-Ow:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=lxrJKfxhxdc:cGdxeQzJ-Ow:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=lxrJKfxhxdc:cGdxeQzJ-Ow:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=lxrJKfxhxdc:cGdxeQzJ-Ow:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=lxrJKfxhxdc:cGdxeQzJ-Ow:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=lxrJKfxhxdc:cGdxeQzJ-Ow:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=lxrJKfxhxdc:cGdxeQzJ-Ow:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=lxrJKfxhxdc:cGdxeQzJ-Ow:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/lxrJKfxhxdc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/08/how-to-resize-an-extjs-panel-grid-component-on-window-resize-without-using-ext-viewport/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/08/how-to-resize-an-extjs-panel-grid-component-on-window-resize-without-using-ext-viewport/</feedburner:origLink></item>
		<item>
		<title>ExtJS plugin: PagingToolbarResizer</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/g9l8Rge92Kw/</link>
		<comments>http://loianegroner.com/2010/08/extjs-plugin-pagingtoolbarresizer/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 10:30:29 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS Plugin]]></category>
		<category><![CDATA[PagingToolbar]]></category>
		<category><![CDATA[PagingToolbarResizer]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=468</guid>
		<description><![CDATA[Well, this is my first ExtJS plugin. Though it is not an advanced plugin, I&#8217;m very happy and it is a big accomplishment for me! The problem: ExtJS PagingToolbar Component allows the developer to set a predetermined page size, which is the total number of records that will be displayed on the grid at once. [...]]]></description>
			<content:encoded><![CDATA[
<p>Well, this is my first ExtJS plugin. Though it is not an advanced plugin, I&#8217;m very happy and it is a big accomplishment for me!</p>
<h3>The problem:</h3>
<p style="text-align: justify;">ExtJS PagingToolbar Component allows the developer to set a predetermined <strong>page size</strong>, which is the total number of records that will be displayed on the grid at once.</p>
<p style="text-align: justify;">Let&#8217;s say we want to display 10,000 (ten thousand) records and we are going to use the paging feature. We are going to display only 50 records at once (per page). If you do the math, it is 200 pages to visualise. No problem so far.</p>
<p style="text-align: justify;">The user User1 wants to see 100 records per page, and the user User2 wants to see 150 records per page, just like we can choose on Ebay search:</p>
<p style="text-align: center;"><a href="http://loianegroner.com/wp-content/uploads/2010/07/extjs_plugin_ebay.png" target="_blank"><img class="aligncenter size-large wp-image-470" title="extjs_plugin_ebay" src="http://loianegroner.com/wp-content/uploads/2010/07/extjs_plugin_ebay-1024x453.png" alt="" width="491" height="218" /></a></p>
<h3>The solution/plugin:</h3>
<p style="text-align: justify;">For this reason, I implemented this plugin PagingToolbarResizer. It adds a combobox (dropdown) on the paging toolbar with some options for page size. It is totally customizable.</p>
<p style="text-align: center;"><a href="http://loianegroner.com/wp-content/uploads/2010/07/extjs_plugin_pagingtoolbarresizer.png" target="_blank"><img class="aligncenter size-full wp-image-471" title="extjs_plugin_pagingtoolbarresizer" src="http://loianegroner.com/wp-content/uploads/2010/07/extjs_plugin_pagingtoolbarresizer.png" alt="" width="493" height="351" /></a></p>
<p>Let&#8217;s take a look at some configuration options:</p>
<ul>
<li><strong><em>options</em></strong>: it can be a store or an array of integers. If you are going to retrieve the options list from database, you should use a store, otherwise you can use a simple array. Defaults to Defaults to [5, 10, 15, 20, 25, 30, 50, 75, 100, 200, 300, 500, 1000].</li>
<li><strong><em>displayText</em></strong>: The message to display before the combobox (defaults to &#8216;Records per Page&#8217;).</li>
<li><strong><em>prependCombo</em></strong>: this flag indicates if you want to display the combobox before paging buttons or after them. Defaults to false.</li>
</ul>
<p>And it is very easy to use:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; highlight: [20]; toolbar: true; wrap-lines: false;">
        // paging bar on the bottom
        bbar: new Ext.PagingToolbar({
            pageSize: 25,
            store: store,
            displayInfo: true,
            displayMsg: 'Displaying topics {0} - {1} of {2}',
            emptyMsg: &quot;No topics to display&quot;,
            items:[
                '-', {
                pressed: true,
                enableToggle:true,
                text: 'Show Preview',
                cls: 'x-btn-text-icon details',
                toggleHandler: function(btn, pressed){
                    var view = grid.getView();
                    view.showPreview = pressed;
                    view.refresh();
                }
            }],
            plugins : [new Ext.ux.plugin.PagingToolbarResizer( {options : [ 5, 10, 15, 20, 25 ], prependCombo: true})]
        })
</pre>
<h3>Links:</h3>
<ul>
<li><a href="http://loianegroner.com/extjs-plugins/pagingtoolbarresizer/" target="_blank"><strong>The &#8220;</strong></a><em><a href="http://loianegroner.com/extjs-plugins/pagingtoolbarresizer/" target="_blank"><strong>official</strong></a></em><a href="http://loianegroner.com/extjs-plugins/pagingtoolbarresizer/" target="_blank"><strong>&#8221; plugin page</strong></a><strong> </strong></li>
<li>You can check out a <a href="http://loianegroner.com/extjs/examples/PagingToolbarResizer/" target="_blank"><strong>working example</strong></a> (it is the same example you are going to find at <a href="http://www.sencha.com/deploy/dev/examples/grid/paging.html" target="_blank"><strong>Sencha website &#8211; ExtJS examples &#8211; PagingToolbar</strong></a>). I just added the plugin.</li>
<li><strong><a href="http://www.sencha.com/forum/showthread.php?105843-PagingToolbarResizer-plugin" target="_blank">The thread at ExtJS forum</a></strong></li>
<li><strong><a href="http://github.com/loiane/Ext.ux.plugin.PagingToolbarResizer" target="_blank">GitHub Link</a></strong></li>
</ul>
<h3 style="text-align: justify;">You can also download the plugin here:</h3>
<p style="text-align: justify;"><a href="http://loianegroner.com/extjs/PagingToolbarResizer.zip" target="_blank">http://loianegroner.com/extjs/PagingToolbarResizer.zip</a></p>
<p style="text-align: justify;">I hope this will help someone!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=468&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=g9l8Rge92Kw:-WQRom6yDkg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=g9l8Rge92Kw:-WQRom6yDkg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=g9l8Rge92Kw:-WQRom6yDkg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=g9l8Rge92Kw:-WQRom6yDkg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=g9l8Rge92Kw:-WQRom6yDkg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=g9l8Rge92Kw:-WQRom6yDkg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=g9l8Rge92Kw:-WQRom6yDkg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=g9l8Rge92Kw:-WQRom6yDkg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/g9l8Rge92Kw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/08/extjs-plugin-pagingtoolbarresizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/08/extjs-plugin-pagingtoolbarresizer/</feedburner:origLink></item>
		<item>
		<title>The Big Website Merge: java.sun.com, developers.sun.com, BigAdmin, and OTN</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/ocxk8YCir-E/</link>
		<comments>http://loianegroner.com/2010/07/the-big-website-merge-java-sun-com-developers-sun-com-bigadmin-and-otn/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 18:02:43 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[SUN]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=446</guid>
		<description><![CDATA[This is the email Oracle sent to JUG Leaders mailing-list: JUG Leaders, Java Champions: You may have noted the reference to a planned Website integration in the FAQ that was published just at Sun/Oracle change-in-control. After months of work and planning by some of the same people who have run these sites for years, this project [...]]]></description>
			<content:encoded><![CDATA[
<p>This is the email Oracle sent to JUG Leaders mailing-list:</p>
<p style="text-align: center;"><a href="http://loianegroner.com/wp-content/uploads/2010/07/oracle-sun-microsystems.jpg"><img class="aligncenter size-full wp-image-447" title="oracle-sun-microsystems" src="http://loianegroner.com/wp-content/uploads/2010/07/oracle-sun-microsystems.jpg" alt="" width="287" height="203" /></a></p>
<blockquote><p>JUG Leaders, Java Champions:</p>
<p>You may have noted the reference to a planned Website integration in the <a href="http://www.oracle.com/technology/community/sun-oracle-community-continuity.html" target="_blank">FAQ</a> that was published just at Sun/Oracle change-in-control. After months of work and planning by some of the same people who have run these sites for years, this project is at hand: On July 19, <a href="http://developers.sun.com/" target="_blank">developers.sun.com</a>, <a href="http://java.sun.com/" target="_blank">java.sun.com</a>, BigAdmin, and Oracle Technology Network will become one (under <a href="http://oracle.com/technetwork" target="_blank">oracle.com/technetwork</a>). Because of your importance in the community, you are the first people to be notified about this news, and we encourage you to share it with your members/peers.</p>
<p>We have tried to anticipate major questions in the new FAQ published <a href="http://www.oracle.com/technology/community/website-faq.html" target="_blank">here</a>. But before you get that far, I want to assure you of some very important things in relation to <a href="http://java.sun.com/" target="_blank">java.sun.com</a>:</p>
<p>- All non-obsolete content will be migrated (yes, a clean-up was done), and when possible, original information architecture will be preserved.<br />
- Although URLs will change, we will implement 1:1 redirects for the most popular/important content from the migrated sites &#8211; including the Java APIs. Your bookmarks won&#8217;t break.<br />
- Java developers will continue to have their own &#8220;place&#8221; in the framework (at<a href="http://oracle.com/technetwork/java" target="_blank">oracle.com/technetwork/java</a>), just as they did under <a href="http://java.sun.com/" target="_blank">java.sun.com</a>, and the content there will continue to be Technology-focused (not product-focused).<br />
- Ultimately, I think you&#8217;ll find the approach similar to that of <a href="http://developers.sun.com/" target="_blank">developers.sun.com</a>.</p>
<p>I encourage you to read the FAQ for more information, and if you have comments or feedback, to provide it via this list or to me directly.</p>
<p>We are going to do everything we can to make this integration as seamless as possible, but the reality is that this project is large and complex; so you may encounter some challenges on the first day. However we’ll make incremental improvements quickly, and we need your help and feedback to do that.</p></blockquote>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=446&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ocxk8YCir-E:1_qCTciM3-E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ocxk8YCir-E:1_qCTciM3-E:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ocxk8YCir-E:1_qCTciM3-E:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=ocxk8YCir-E:1_qCTciM3-E:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ocxk8YCir-E:1_qCTciM3-E:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ocxk8YCir-E:1_qCTciM3-E:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=ocxk8YCir-E:1_qCTciM3-E:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ocxk8YCir-E:1_qCTciM3-E:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/ocxk8YCir-E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/07/the-big-website-merge-java-sun-com-developers-sun-com-bigadmin-and-otn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/07/the-big-website-merge-java-sun-com-developers-sun-com-bigadmin-and-otn/</feedburner:origLink></item>
		<item>
		<title>Hibernate 3 Annotations Tutorial</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/qTlLZr-RwQE/</link>
		<comments>http://loianegroner.com/2010/06/hibernate-3-annotations-tutorial/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 11:17:43 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[hibernate 3]]></category>
		<category><![CDATA[hibernate annotations]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=416</guid>
		<description><![CDATA[This tutorial will walk through how to implement a hello world project using Hibernate Annotations and MySQL database. Requirements Download and unzip Hibernate Core distribution from the Hibernate website. Hibernate 3.5 and onward contains Hibernate Annotations. Starting with version 3.5 (currently trunk), Annotations and EntityManager have been merged back into the Hibernate Core codebase as invidual [...]]]></description>
			<content:encoded><![CDATA[
<p>This tutorial will walk through how to implement a hello world project using Hibernate Annotations and <a href="http://dev.mysql.com/" target="_blank">MySQL database</a>.</p>
<h3>Requirements</h3>
<ul>
<li style="text-align: justify;">Download and unzip <a href="http://sourceforge.net/projects/hibernate/files/hibernate3/" target="_blank">Hibernate Core distribution</a> from the <a href="http://www.hibernate.org/" target="_blank">Hibernate website</a>. Hibernate 3.5 and onward contains Hibernate Annotations.</li>
<blockquote style="text-align: justify;"><p>Starting with version 3.5 (currently trunk), Annotations and EntityManager have been merged back into the Hibernate Core codebase as invidual modules.  We will also begin bundling Envers at the same time.  This will significantly help simplify compatibility guidelines.</p></blockquote>
</ul>
<ul>
<li style="text-align: justify;">Download <a href="http://www.slf4j.org/download.html" target="_blank">SLF4 </a>lib as well.</li>
<li style="text-align: justify;">Download the database connector. In this example, I&#8217;m using <a href="http://dev.mysql.com/downloads/connector/j/" target="_blank">MySQL database</a>.</li>
</ul>
<h3>Configuration</h3>
<p>First, set up your classpath:</p>
<ul>
<li>Copy <strong>hibernate3.jar</strong> and the required 3rd party libraries available in <strong>lib/required</strong>.</li>
<li>Copy <strong>lib/jpa/hibernate-jpa-2.0-api-1.0.0.Final.jar</strong> to your classpath as well.</li>
<li>Also copy <strong>slf4j-simple-1.5.8.jar</strong> from SLF4 (I&#8217;ve got an exception without this lbi in my classpath)</li>
</ul>
<p>The picture will all required libraries is given bellow:</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/06/hibernate_3_annotations_tutorial_loiane_01.gif"><img class="aligncenter size-full wp-image-418" title="hibernate_3_annotations_tutorial_loiane_01" src="http://loianegroner.com/wp-content/uploads/2010/06/hibernate_3_annotations_tutorial_loiane_01.gif" alt="" width="269" height="259" /></a></p>
<p>Let&#8217;s start by creating our POJO (Plain Old Java Object) class that represents the table in the database.</p>
<p>This is the City table:</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/06/hibernate_3_annotations_tutorial_loiane_02.png"><img class="aligncenter size-full wp-image-425" title="hibernate_3_annotations_tutorial_loiane_02" src="http://loianegroner.com/wp-content/uploads/2010/06/hibernate_3_annotations_tutorial_loiane_02.png" alt="" width="140" height="106" /></a>And here is the <strong>City</strong> class:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.com.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name=&quot;CITY&quot;)
public class City {

	private long id;

	private String name;

	public City(String name) {
		super();
		this.name = name;
	}

	public City() {}

	@Id
	@GeneratedValue
	@Column(name=&quot;CITY_ID&quot;)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@Column(name=&quot;CITY_NAME&quot;, nullable=false)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
</pre>
<p>Here is a list of all annotations used and its meaning:</p>
<ul>
<li><strong>@Entity</strong> declares the class as an entity (i.e. a persistent POJO class)</li>
<li><strong>@Table</strong> is set at the class level; it allows you to define the table, catalog, and schema names for your entity mapping. If no @Table is defined the default values are used: the unqualified class name of the entity.</li>
<li><strong>@Id</strong> declares the identifier property of this entity.</li>
<li><strong>@GeneratedValue</strong> annotation is used to specify the primary key generation strategy to use. If the strategy is not specified by default AUTO will be used.</li>
<li><strong>@Column</strong> annotation is used to specify the details of the column to which a field or property will be mapped. If the @Column annotation is not specified by default the property name will be used as the column name.</li>
</ul>
<p>You also need to create the <strong><em>HibernateUtil</em></strong> class. The <strong><em>HibernateUtil </em></strong>class helps in creating the <em>SessionFactory</em> from the Hibernate configuration file. Its implementation is shown bellow:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import com.loiane.com.model.City;

public class HibernateUtil {

	private static final SessionFactory sessionFactory;

	static {
		try {
			sessionFactory = new AnnotationConfiguration()
								.configure()
								.addPackage(&quot;com.loiane.model&quot;) //the fully qualified package name
								.addAnnotatedClass(City.class)
								.buildSessionFactory();

		} catch (Throwable ex) {
			System.err.println(&quot;Initial SessionFactory creation failed.&quot; + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
}
</pre>
<p>You need to create a <em><strong>hibernate.cfg.xml</strong></em><em> </em>as well, with all the information needed to connect to the database, such as database url, user, password:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE hibernate-configuration PUBLIC
		&quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&quot;
		&quot;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&quot;&gt;
&lt;hibernate-configuration&gt;
    &lt;session-factory&gt;
        &lt;property name=&quot;hibernate.connection.driver_class&quot;&gt;com.mysql.jdbc.Driver&lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.password&quot;&gt;root&lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.url&quot;&gt;jdbc:mysql://localhost/blog&lt;/property&gt;
        &lt;property name=&quot;hibernate.connection.username&quot;&gt;root&lt;/property&gt;
        &lt;property name=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
    	&lt;property name=&quot;connection.pool_size&quot;&gt;1&lt;/property&gt;
    	&lt;property name=&quot;show_sql&quot;&gt;true&lt;/property&gt;
        &lt;property name=&quot;hbm2ddl.auto&quot;&gt;create&lt;/property&gt;
    &lt;/session-factory&gt;
&lt;/hibernate-configuration&gt;
</pre>
<p>Here is an example of how to select, update, insert and delete a City:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.dao;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.loiane.com.model.City;
import com.loiane.util.HibernateUtil;

public class CityDAO {

	public Long saveCity(String cityName)
	{
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		Long cityId = null;
		try {
			transaction = session.beginTransaction();
			City city = new City();
			city.setName(cityName);
			cityId = (Long) session.save(city);
			transaction.commit();
		} catch (HibernateException e) {
			transaction.rollback();
			e.printStackTrace();
		} finally {
			session.close();
		}
		return cityId;
	}

	@SuppressWarnings(&quot;unchecked&quot;)
	public void listCities()
	{
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		try {
			transaction = session.beginTransaction();
			List&lt;City&gt; cities = session.createQuery(&quot;from City&quot;).list();

			for (City city : cities){
				System.out.println(city.getName());
			}

			transaction.commit();
		} catch (HibernateException e) {
			transaction.rollback();
			e.printStackTrace();
		} finally {
			session.close();
		}
	}

	public void updateCity(Long cityId, String cityName)
	{
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		try {
			transaction = session.beginTransaction();
			City city = (City) session.get(City.class, cityId);
			city.setName(cityName);
			transaction.commit();
		} catch (HibernateException e) {
			transaction.rollback();
			e.printStackTrace();
		} finally {
			session.close();
		}
	}

	public void deleteCity(Long cityId)
	{
		Session session = HibernateUtil.getSessionFactory().openSession();
		Transaction transaction = null;
		try {
			transaction = session.beginTransaction();
			City city = (City) session.get(City.class, cityId);
			session.delete(city);
			transaction.commit();
		} catch (HibernateException e) {
			transaction.rollback();
			e.printStackTrace();
		} finally {
			session.close();
		}
	}
}
</pre>
<p>and the Main class (you can try to run this class):</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.main;

import com.loiane.dao.CityDAO;

public class Main {

	public static void main(String[] args) {

		CityDAO cityDAO = new CityDAO();

		long cityId1 = cityDAO.saveCity(&quot;New York&quot;);
		long cityId2 = cityDAO.saveCity(&quot;Rio de Janeiro&quot;);
		long cityId3 = cityDAO.saveCity(&quot;Tokyo&quot;);
		long cityId4 = cityDAO.saveCity(&quot;London&quot;);

		cityDAO.listCities();

		cityDAO.updateCity(cityId4, &quot;Paris&quot;);

		cityDAO.deleteCity(cityId3);

		cityDAO.listCities();
	}
}
</pre>
<p>If your setup is OK, this is the output:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
Hibernate: insert into CITY (CITY_NAME) values (?)
Hibernate: insert into CITY (CITY_NAME) values (?)
Hibernate: insert into CITY (CITY_NAME) values (?)
Hibernate: insert into CITY (CITY_NAME) values (?)
Hibernate: select city0_.CITY_ID as CITY1_0_, city0_.CITY_NAME as CITY2_0_ from CITY city0_
New York
Rio de Janeiro
Tokyo
London
Hibernate: select city0_.CITY_ID as CITY1_0_0_, city0_.CITY_NAME as CITY2_0_0_ from CITY city0_ where city0_.CITY_ID=?
Hibernate: update CITY set CITY_NAME=? where CITY_ID=?
Hibernate: select city0_.CITY_ID as CITY1_0_0_, city0_.CITY_NAME as CITY2_0_0_ from CITY city0_ where city0_.CITY_ID=?
Hibernate: delete from CITY where CITY_ID=?
Hibernate: select city0_.CITY_ID as CITY1_0_, city0_.CITY_NAME as CITY2_0_ from CITY city0_
New York
Rio de Janeiro
Paris
</pre>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/06/hibernate_3_annotations_tutorial_loiane_03.gif"><img class="aligncenter size-full wp-image-426" title="hibernate_3_annotations_tutorial_loiane_03" src="http://loianegroner.com/wp-content/uploads/2010/06/hibernate_3_annotations_tutorial_loiane_03.gif" alt="" width="419" height="138" /></a></p>
<p>You do not need to worry about creating the table in the database.The bellow configuration does it for you!</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;property name=&quot;hbm2ddl.auto&quot;&gt;create&lt;/property&gt;
</pre>
<p>For more information about Hibernate Annotations, please read the <a href="http://docs.jboss.org/hibernate/stable/annotations/reference/en/html/index.html" target="_blank">Hibernate Documentation</a>.</p>
<p>You can download the complete source code (including all the libraries) from my GitHub repository: <a href="http://github.com/loiane/hibernate-annotations" target="_blank">http://github.com/loiane/hibernate-annotations</a></p>
<p>I developed this sample project using <a href="http://www.eclipse.org/" target="_blank">Eclipse IDE</a>.</p>
<p>Happy Coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=416&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qTlLZr-RwQE:imanG33GK5s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qTlLZr-RwQE:imanG33GK5s:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qTlLZr-RwQE:imanG33GK5s:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=qTlLZr-RwQE:imanG33GK5s:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qTlLZr-RwQE:imanG33GK5s:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qTlLZr-RwQE:imanG33GK5s:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=qTlLZr-RwQE:imanG33GK5s:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qTlLZr-RwQE:imanG33GK5s:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/qTlLZr-RwQE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/06/hibernate-3-annotations-tutorial/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/06/hibernate-3-annotations-tutorial/</feedburner:origLink></item>
		<item>
		<title>I’m a DZone MVB (Most Valuable Blogger)!</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/VtSen9YLqFQ/</link>
		<comments>http://loianegroner.com/2010/06/i%e2%80%99m-a-dzone-mvb-most-valuable-blogger/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 10:30:43 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DZONE]]></category>
		<category><![CDATA[DZONE MVB]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=414</guid>
		<description><![CDATA[Check it out, I&#8217;m a DZone MVB (Most Valuable Blogger)! Thanks to the DZone team for inviting me. I&#8217;m very honored to be part of this program! DZone&#8217;s MVB program brings together a group of highly talented bloggers, authors, and technologists actively writing about topics of interest to the developer community. These people are recognized [...]]]></description>
			<content:encoded><![CDATA[
<p>Check it out, I&#8217;m a DZone <a href="http://www.dzone.com/page/mvbs" target="_blank">MVB (Most Valuable Blogger)</a>!</p>
<p>Thanks to the DZone team for inviting me. I&#8217;m very honored to be part of this program!</p>
<blockquote>
<p style="text-align: justify;">DZone&#8217;s MVB program brings together a group of highly talented bloggers, authors, and technologists actively writing about topics of interest to the developer community. These people are recognized in the industry for their contributions and deep technical knowledge on subjects ranging from software design and architecture to programming on a range of platforms including Java, .NET, Ruby and others.</p>
</blockquote>
<p>They already posted the first article, <a href="http://www.dzone.com/articles/how-populate-ext-js-combobox">How to Populate Ext JS ComboBox using Spring Controller</a>, which you can see in the picture bellow (It&#8217;s official!) <img src='http://loianegroner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: center;"><a href="http://loianegroner.com/wp-content/uploads/2010/06/Loiane_dzone_mvb.png" target="_blank"><img class="aligncenter size-large wp-image-437" title="Loiane_dzone_mvb" src="http://loianegroner.com/wp-content/uploads/2010/06/Loiane_dzone_mvb-694x1024.png" alt="" width="555" height="819" /></a></p>
<p style="text-align: justify;">I&#8217;m very happy, because the is so many talented bloggers and professionals in this program. It is really an honor for me. You can see all MVBs in tthis link: <a href="http://www.dzone.com/page/mvbs" target="_blank">http://www.dzone.com/page/mvbs</a></p>
<p style="text-align: justify;">Thanks everyone! <img src='http://loianegroner.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=414&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VtSen9YLqFQ:sSqz2K0N6eg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VtSen9YLqFQ:sSqz2K0N6eg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VtSen9YLqFQ:sSqz2K0N6eg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=VtSen9YLqFQ:sSqz2K0N6eg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VtSen9YLqFQ:sSqz2K0N6eg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VtSen9YLqFQ:sSqz2K0N6eg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=VtSen9YLqFQ:sSqz2K0N6eg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VtSen9YLqFQ:sSqz2K0N6eg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/VtSen9YLqFQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/06/i%e2%80%99m-a-dzone-mvb-most-valuable-blogger/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/06/i%e2%80%99m-a-dzone-mvb-most-valuable-blogger/</feedburner:origLink></item>
		<item>
		<title>ExtJS: Stop the “page contains secure and nonsecure items” Warning</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/16C7kxBCw3Q/</link>
		<comments>http://loianegroner.com/2010/05/extjs-stop-the-page-contains-secure-and-nonsecure-items-warning/#comments</comments>
		<pubDate>Mon, 24 May 2010 10:30:14 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[nonsecure items]]></category>
		<category><![CDATA[security violation pop-up]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=399</guid>
		<description><![CDATA[Are your SSL web pages plagued by the browser warning &#8220;This page contains both secure and nonsecure items. Do you want to display the nonsecure items?&#8220; This is a common error that occurs when some element on a secure web page (one that is loaded with https:// in the address bar) is not being loaded [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;">Are your SSL web pages plagued by the browser warning &#8220;<strong>This page contains both secure and nonsecure items. Do you want to display the nonsecure items?</strong>&#8220;</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/05/ie7-security-warning.gif"><img class="aligncenter size-full wp-image-400" title="ie7-security-warning" src="http://loianegroner.com/wp-content/uploads/2010/05/ie7-security-warning.gif" alt="" width="332" height="150" /></a></p>
<p style="text-align: justify;">This is a common error that occurs when some element on a secure web page (one that is loaded with <strong>https</strong>:// in the address bar) is not being loaded from a secure source. This usually occurs with images, frames, iframes, Flash, and JavaScripts.</p>
<h3>How to solve this &#8220;<em>issue</em>&#8221; if the system was developed with ExtJS?</h3>
<p>There is a property in <a href="http://www.extjs.com/deploy/ext/docs/output/Ext.html" target="_blank">Ext class</a> named <a href="http://www.extjs.com/deploy/ext/docs/output/Ext.html#BLANK_IMAGE_URL">BLANK_IMAGE_URL</a>:</p>
<blockquote>
<p style="text-align: justify;">&#8220;URL to a 1&#215;1 transparent gif image used by Ext to create inline icons with CSS background images. (Defaults to &#8220;<em><strong>http://extjs.com/s.gif</strong></em>&#8221; and you should change this to a URL on your server).&#8221;</p>
</blockquote>
<p>Following are given a screenshot from Firebug when I loaded an application which uses ExtJS:</p>
<p style="text-align: left;"><a href="http://loianegroner.com/wp-content/uploads/2010/05/extjs_secure_warning_loiane1.gif"><img class="aligncenter size-full wp-image-402" title="extjs_secure_warning_loiane" src="http://loianegroner.com/wp-content/uploads/2010/05/extjs_secure_warning_loiane1.gif" alt="" width="518" height="38" /></a></p>
<p style="text-align: justify;">The solution is very simple. You need to point BLANK_IMAGE_URL to &#8220;s.gif&#8221; image that is in your application&#8217;s directory.</p>
<p style="text-align: left;">For example:  if your application&#8217;s name is &#8220;<em><a href="http://github.com/loiane/extjs-crud-grid" target="_blank">extjs-crud-grid</a></em>&#8220;, you should point it to:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
Ext.onReady(function(){
     Ext.BLANK_IMAGE_URL = '/extjs-crud-grid/ext-3.1.1/resources/images/default/s.gif';
)};
</pre>
<p><em><a href="http://github.com/loiane/extjs-crud-grid" target="_blank">extjs-crud-grid</a></em> application&#8217;s directory:</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/05/extjs_nonsecure_warning_02.gif"><img class="aligncenter size-full wp-image-403" title="extjs_nonsecure_warning_02" src="http://loianegroner.com/wp-content/uploads/2010/05/extjs_nonsecure_warning_02.gif" alt="" width="365" height="815" /></a></p>
<p>Hope it helped!</p>
<p>Happy coding! <img src='http://loianegroner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=399&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=16C7kxBCw3Q:Q9YDzKAd3vQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=16C7kxBCw3Q:Q9YDzKAd3vQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=16C7kxBCw3Q:Q9YDzKAd3vQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=16C7kxBCw3Q:Q9YDzKAd3vQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=16C7kxBCw3Q:Q9YDzKAd3vQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=16C7kxBCw3Q:Q9YDzKAd3vQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=16C7kxBCw3Q:Q9YDzKAd3vQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=16C7kxBCw3Q:Q9YDzKAd3vQ:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/16C7kxBCw3Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/05/extjs-stop-the-page-contains-secure-and-nonsecure-items-warning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/05/extjs-stop-the-page-contains-secure-and-nonsecure-items-warning/</feedburner:origLink></item>
		<item>
		<title>How to Populate Ext JS ComboBox using Spring Controller</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/-MKvVUt9oBI/</link>
		<comments>http://loianegroner.com/2010/05/how-to-populate-ext-js-combobox-using-spring-controller/#comments</comments>
		<pubDate>Wed, 19 May 2010 10:30:21 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[ExtJS ComboBox]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring MVC]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=393</guid>
		<description><![CDATA[This tutorial will walk through how to populate an ExtJS ComboBox using a Spring Controller. To populate ExtJS ComboBox using Spring Controller, you need create an Ajax request using Ext.data.HttpProxy and as response you can return JSON Objects (or an XML &#8211; in this example, I will use JSON). And using a JsonReader, you can read [...]]]></description>
			<content:encoded><![CDATA[
<p>This tutorial will walk through how to populate an ExtJS ComboBox using a Spring Controller.</p>
<p style="text-align: justify;">To populate ExtJS ComboBox using Spring Controller, you need create an Ajax request using <em>Ext.data.HttpProxy </em>and as response you can return JSON Objects (or an XML &#8211; in this example, I will use JSON). And using a <em>JsonReader</em>, you can read values and popolate <em>ComboBox</em>. It is the same logic used to populate an ExtJS DataGrid.</p>
<p style="text-align: justify;">Frameworks/Libraries I&#8217;m using in this tutorial:</p>
<ul style="text-align: justify;">
<li>ExtJS (you can download the lastest version <a href="http://www.extjs.com/products/js/download.php" target="_blank">here</a>);</li>
<li><a href="http://www.springsource.org/download" target="_blank">Spring MVC 3</a></li>
<li><a href="http://jackson.codehaus.org/" target="_blank">Jackson</a> (used to return JSON from Spring Controller)</li>
</ul>
<p style="text-align: justify;">If you are using Spring 2.5, you can see my <a href="http://loianegroner.com/sitemap-loian/" target="_blank">other examples</a> of how to return <a href="http://loianegroner.com/2010/02/spring-mvc-and-ajax-with-json/" target="_blank">JSON from Spring using Spring-JSON lib</a>.</p>
<p style="text-align: justify;">I am going to create a combobox to list all <a href="http://en.wikipedia.org/wiki/States_of_Brazil" target="_blank">states of Brazil</a>. The screenshot of this tutorial is given bellow:</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/05/ExtJS_ComboBox_SpringController_Loiane_01.gif"><img class="aligncenter size-full wp-image-394" title="ExtJS_ComboBox_SpringController_Loiane_01" src="http://loianegroner.com/wp-content/uploads/2010/05/ExtJS_ComboBox_SpringController_Loiane_01.gif" alt="" width="250" height="380" /></a></p>
<p>First step is to create  a <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank">POJO </a>(Java Object with getters and setters methods only &#8211; and constructor):</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
public class State {

	private String code;
	private String name;

	public State(String code, String name) {
		super();
		this.code = code;
		this.name = name;
	}

        //get and set methods
}
</pre>
<p>Following is the Controller. The request is mapped to loadStates() method, which retrieves states from a source (I&#8217;m using a method for academic puporses, but you can retrieve data from a database):</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
@Controller
public class StateController {

	private StateService stateService;

	@RequestMapping(value=&quot;getStates.json&quot;, method = RequestMethod.GET)
	public @ResponseBody Map&lt;String,? extends Object&gt; loadStates() {

		HashMap&lt;String, List&lt;State&gt;&gt; modelMap = new HashMap&lt;String,List&lt;State&gt;&gt;();
		modelMap.put(&quot;states&quot;, stateService.getBrazilianStates());

		return modelMap;
	}

	@Autowired
	public void setStateService(StateService stateService) {
		this.stateService = stateService;
	}
}
</pre>
<p style="text-align: justify;">The @ResponseBody converts automaticaly the Map object into a JSON object, because of Jackson. Find out about Spring 3 Ajax simplifications <a href="http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/" target="_blank">here</a>. This is the JSON object the loadStates method returns to the browser:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
{&quot;states&quot;:[{&quot;name&quot;:&quot;Acre&quot;,&quot;code&quot;:&quot;AC&quot;},{&quot;name&quot;:&quot;Alagoas&quot;,&quot;code&quot;:&quot;AL&quot;},{&quot;name&quot;:&quot;Amapá&quot;,&quot;code&quot;:&quot;AP&quot;},{&quot;name&quot;:&quot;Amazonas&quot;,&quot;code&quot;:&quot;AM&quot;},{&quot;name&quot;:&quot;Bahia&quot;,&quot;code&quot;:&quot;BA&quot;},{&quot;name&quot;:&quot;Ceará&quot;,&quot;code&quot;:&quot;CE&quot;},{&quot;name&quot;:&quot;Distrito Federal&quot;,&quot;code&quot;:&quot;DF&quot;},{&quot;name&quot;:&quot;Espírito Santo&quot;,&quot;code&quot;:&quot;ES&quot;},{&quot;name&quot;:&quot;Goiás&quot;,&quot;code&quot;:&quot;GO&quot;},{&quot;name&quot;:&quot;Maranhão&quot;,&quot;code&quot;:&quot;MA&quot;},{&quot;name&quot;:&quot;Mato Grosso&quot;,&quot;code&quot;:&quot;MT&quot;},{&quot;name&quot;:&quot;Mato Grosso do Sul&quot;,&quot;code&quot;:&quot;MS&quot;},{&quot;name&quot;:&quot;Minas Gerais&quot;,&quot;code&quot;:&quot;MG&quot;},{&quot;name&quot;:&quot;Pará&quot;,&quot;code&quot;:&quot;PA&quot;},{&quot;name&quot;:&quot;Paraíba&quot;,&quot;code&quot;:&quot;PB&quot;},{&quot;name&quot;:&quot;Paraná&quot;,&quot;code&quot;:&quot;PR&quot;},{&quot;name&quot;:&quot;Pernambuco&quot;,&quot;code&quot;:&quot;PE&quot;},{&quot;name&quot;:&quot;Piauí&quot;,&quot;code&quot;:&quot;PI&quot;},{&quot;name&quot;:&quot;Rio de Janeiro&quot;,&quot;code&quot;:&quot;RJ&quot;},{&quot;name&quot;:&quot;Rio Grande do Norte&quot;,&quot;code&quot;:&quot;RN&quot;},{&quot;name&quot;:&quot;Rio Grande do Sul&quot;,&quot;code&quot;:&quot;RS&quot;},{&quot;name&quot;:&quot;Rondônia&quot;,&quot;code&quot;:&quot;RO&quot;},{&quot;name&quot;:&quot;Roraima&quot;,&quot;code&quot;:&quot;RR&quot;},{&quot;name&quot;:&quot;Santa Catarina&quot;,&quot;code&quot;:&quot;SC&quot;},{&quot;name&quot;:&quot;São Paulo&quot;,&quot;code&quot;:&quot;SP&quot;},{&quot;name&quot;:&quot;Sergipe&quot;,&quot;code&quot;:&quot;SE&quot;},{&quot;name&quot;:&quot;Tocantins&quot;,&quot;code&quot;:&quot;TO&quot;}]}
</pre>
<p>The content above is retrieved from this method in the StateService class:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
@Service
public class StateService {

	public List&lt;State&gt; getBrazilianStates(){

		List&lt;State&gt; states = new ArrayList&lt;State&gt;();

		states.add(new State(&quot;AC&quot;,&quot;Acre&quot;));
		states.add(new State(&quot;AL&quot;,&quot;Alagoas&quot;));
		states.add(new State(&quot;AP&quot;,&quot;Amapá&quot;));
		states.add(new State(&quot;AM&quot;,&quot;Amazonas&quot;));
		states.add(new State(&quot;BA&quot;,&quot;Bahia&quot;));
		states.add(new State(&quot;CE&quot;,&quot;Ceará&quot;));
		states.add(new State(&quot;DF&quot;,&quot;Distrito Federal&quot;));
		states.add(new State(&quot;ES&quot;,&quot;Espírito Santo&quot;));
		states.add(new State(&quot;GO&quot;,&quot;Goiás&quot;));
		states.add(new State(&quot;MA&quot;,&quot;Maranhão&quot;));
		states.add(new State(&quot;MT&quot;,&quot;Mato Grosso&quot;));
		states.add(new State(&quot;MS&quot;,&quot;Mato Grosso do Sul&quot;));
		states.add(new State(&quot;MG&quot;,&quot;Minas Gerais&quot;));
		states.add(new State(&quot;PA&quot;,&quot;Pará&quot;));
		states.add(new State(&quot;PB&quot;,&quot;Paraíba&quot;));
		states.add(new State(&quot;PR&quot;,&quot;Paraná&quot;));
		states.add(new State(&quot;PE&quot;,&quot;Pernambuco&quot;));
		states.add(new State(&quot;PI&quot;,&quot;Piauí&quot;));
		states.add(new State(&quot;RJ&quot;,&quot;Rio de Janeiro&quot;));
		states.add(new State(&quot;RN&quot;,&quot;Rio Grande do Norte&quot;));
		states.add(new State(&quot;RS&quot;,&quot;Rio Grande do Sul&quot;));
		states.add(new State(&quot;RO&quot;,&quot;Rondônia&quot;));
		states.add(new State(&quot;RR&quot;,&quot;Roraima&quot;));
		states.add(new State(&quot;SC&quot;,&quot;Santa Catarina&quot;));
		states.add(new State(&quot;SP&quot;,&quot;São Paulo&quot;));
		states.add(new State(&quot;SE&quot;,&quot;Sergipe&quot;));
		states.add(new State(&quot;TO&quot;,&quot;Tocantins&quot;));

		return states;
	}
}
</pre>
<p>Finally, here is the ExtJS code for combobox:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
Ext.onReady(function(){

	var store = new Ext.data.Store({
		proxy: new Ext.data.HttpProxy({
			url: 'getStates.json'
		}),
		reader: new Ext.data.JsonReader({
			root:'states'
		},
		[{name: 'code'},
		 {name: 'name'}
		])
	});

	var combo = new Ext.form.ComboBox({
		id: 'statesCombo',
		store: store,
		displayField: 'name',
		valueField: 'code',
		hiddenName : 'codeId',
		typeAhead: true,
		mode: 'local',
		fieldLabel: 'States of Brazil',
		anchor: '100%',
		forceSelection: true,
		triggerAction: 'all',
		emptyText:'Select a state...',
		selectOnFocus:true
	});

	var stateForm = new Ext.FormPanel({
		frame:true,
		url: 'saveState.json',
		title: 'Combo Box Example',
		bodyStyle:'padding:5px 5px 0',
		width: 250,
		labelAlign: 'top',
		layout: 'form',
		items: [combo]
	});

	store.load();

	stateForm.render(document.body);

});
</pre>
<p style="text-align: justify;">You can download the complete project from my GitHub repository: <a href="http://github.com/loiane/extjs-combobox" target="_blank">http://github.com/loiane/extjs-combobox</a><br />
I developed this sample project on Eclipse, and I used TomCat as webserver.</p>
<p>Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=393&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-MKvVUt9oBI:zPIc4Cv4l9I:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-MKvVUt9oBI:zPIc4Cv4l9I:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-MKvVUt9oBI:zPIc4Cv4l9I:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=-MKvVUt9oBI:zPIc4Cv4l9I:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-MKvVUt9oBI:zPIc4Cv4l9I:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-MKvVUt9oBI:zPIc4Cv4l9I:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=-MKvVUt9oBI:zPIc4Cv4l9I:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-MKvVUt9oBI:zPIc4Cv4l9I:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/-MKvVUt9oBI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/05/how-to-populate-ext-js-combobox-using-spring-controller/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/05/how-to-populate-ext-js-combobox-using-spring-controller/</feedburner:origLink></item>
		<item>
		<title>Populating an ExtJS DataGrid + RowExpander using Spring MVC 3</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/mydey047skc/</link>
		<comments>http://loianegroner.com/2010/05/populating-an-extjs-datagrid-rowexpander-using-spring-mvc-3/#comments</comments>
		<pubDate>Fri, 14 May 2010 00:08:42 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[ExtJS Grid]]></category>
		<category><![CDATA[ExtJS Plugin]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[RowExpander]]></category>
		<category><![CDATA[Spring 3]]></category>
		<category><![CDATA[Spring MVC]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=375</guid>
		<description><![CDATA[This tutorial will walk through how to implement an ExtJS DataGrid with RowExpander plugin using Spring MVC Framework version 3 in the server side. Sometimes you need to show more information than fits within the grid, as an expansion of the record/row. ExtJS DataGrid component provides a plugin called RowExpander, which does exactly what its [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;">This tutorial will walk through how to implement an ExtJS DataGrid with RowExpander plugin using Spring MVC Framework version 3 in the server side.</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/05/ExtJS_RowExpander_Spring3_Loiane_01.gif"><img class="aligncenter size-full wp-image-376" title="ExtJS_RowExpander_Spring3_Loiane_01" src="http://loianegroner.com/wp-content/uploads/2010/05/ExtJS_RowExpander_Spring3_Loiane_01.gif" alt="" width="517" height="383" /></a></p>
<p style="text-align: justify;">Sometimes you need to show more information than fits within the grid, as an expansion of the record/row. ExtJS DataGrid component provides a plugin called RowExpander, which does exactly what its name says and I just described before.</p>
<p style="text-align: justify;">It is very simple to use.</p>
<p style="text-align: justify;">Let’s say you want to show information about some books. The following class represents your data (it is a POJO):</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
public class Book {

	private int id;
	private String title;
	private String publisher;
	private String ISBN10;
	private String ISBN13;
	private String link;
	private String description;
}
</pre>
<p style="text-align: justify;">But you do not want to show all the attributes within the grid. You just want to show the book title and the publisher, and if the user wants to know more about that book, he/she has to expand the row.  First, let’s declare a JSON store to get data from server. You can configure the store normally, as all the data is going to be a column in the datagrid.</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
	var store = new Ext.data.Store({
		proxy: new Ext.data.HttpProxy({
			url: 'getBooks.action'
		}),
		reader: new Ext.data.JsonReader({
			root:'books'
		},
		[{name: 'id'},
		 {name: 'title'},
		 {name: 'publisher'},
		 {name: 'isbn10'},
		 {name: 'isbn13'},
		 {name: 'link'},
		 {name: 'description'},
		])
	});
</pre>
<p>And a method in the server to retrieve the data:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
@Controller
public class BookController {

	private BookService bookService;

	/**
	 * Get all the books from &quot;database&quot; to display on
	 * ExtJS data grid
	 * @return JSON object
	 */
	@RequestMapping(value=&quot;getBooks.action&quot;, method = RequestMethod.GET)
	public @ResponseBody Map&lt;String,? extends Object&gt; view() {

		List&lt;Book&gt; books = bookService.getBooks();

		Map&lt;String,Object&gt; modelMap = new HashMap&lt;String,Object&gt;();
		modelMap.put(&quot;books&quot;, books);

		return modelMap;
	}

	@Autowired
	public void setBookService(BookService bookService) {
		this.bookService = bookService;
	}
}
</pre>
<blockquote style="text-align: justify;"><p>To learn more about Spring 3 annotations and how to retrieve data from server in JSON data format, please read: <a href="http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/" target="_blank">http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/</a></p></blockquote>
<p>Let’s declare the datagrid:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; highlight: [9,16]; toolbar: true; wrap-lines: false;">
    var gridBooks = new Ext.grid.GridPanel({
        store: store,
        cm: new Ext.grid.ColumnModel({
            defaults: {
                sortable: true,
                width: 200
            },
            columns: [
                expander,
                {header: &quot;Title&quot;, dataIndex: 'title'},
                {header: &quot;Publisher&quot;, dataIndex: 'publisher'}
            ]
        }),
        width: 430,
        height: 270,
        plugins: expander,
        title: 'ExtJS Books',
        renderTo: 'gridBooks'
    });
</pre>
<p style="text-align: justify;">You need to declare the rowExpander plugin as a column (first one – line  9), just like you need to do when you use <a href="http://www.extjs.com/deploy/ext/docs/output/Ext.grid.ColumnModel.html" target="_blank">ColumnModel</a> (checkbox), and you also need to declare it as a plugin (line 16).</p>
<p>And now, let’s take a look how to declare the plugin:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var expander = new Ext.ux.grid.RowExpander({
        tpl : new Ext.Template(
            '&lt;br&gt;&lt;p&gt;&lt;b&gt;ISBN10:&lt;/b&gt; {isbn10}&lt;/p&gt;&lt;br&gt;',
            '&lt;p&gt;&lt;b&gt;ISBN13:&lt;/b&gt; {isbn13}&lt;/p&gt;&lt;br&gt;',
            '&lt;p&gt;&lt;b&gt;Link:&lt;/b&gt; &lt;a href=&quot;{link}&quot; target=&quot;_blank&quot;&gt;{link}&lt;/a&gt;&lt;/p&gt;&lt;br&gt;',
            '&lt;p&gt;&lt;b&gt;Description:&lt;/b&gt; {description}&lt;/p&gt;'
        )
    });
</pre>
<p style="text-align: justify;">Let you imagination flow and create the expansion you want using HTML or anything <a href="http://www.extjs.com/learn/Tutorial:Getting_Started_with_Templates" target="_blank">Ext.Template enables you to do</a>!</p>
<p>Don’t forget to import RowExpander javascript file:</p>
<pre class="brush: xml; collapse: false; first-line: 1; highlight: [13]; toolbar: true; wrap-lines: false;">
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&gt;
&lt;title&gt;Row Expander + Spring&lt;/title&gt;

	&lt;!-- ExtJS css --&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-rowexpander/ext-3.2.1/resources/css/ext-all.css&quot; /&gt;

	&lt;!-- ExtJS js --&gt;
	&lt;script src=&quot;/extjs-rowexpander/ext-3.2.1/adapter/ext/ext-base.js&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;/extjs-rowexpander/ext-3.2.1/ext-all.js&quot;&gt;&lt;/script&gt;

	&lt;script type=&quot;text/javascript&quot; src=&quot;/extjs-rowexpander/ext-3.2.1/examples/ux/RowExpander.js&quot;&gt;&lt;/script&gt;

	&lt;!-- App js --&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;/extjs-rowexpander/js/books-grid-row-expander.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;br&gt;
	&lt;div id=&quot;gridBooks&quot; align=&quot;center&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p style="text-align: justify;">You can download the complete project from my GitHub repository: <a href="http://github.com/loiane/extjs-rowexpander" target="_blank">http://github.com/loiane/extjs-rowexpander</a></p>
<p>Happy Coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=375&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=mydey047skc:DkmDDXxcV_A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=mydey047skc:DkmDDXxcV_A:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=mydey047skc:DkmDDXxcV_A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=mydey047skc:DkmDDXxcV_A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=mydey047skc:DkmDDXxcV_A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=mydey047skc:DkmDDXxcV_A:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=mydey047skc:DkmDDXxcV_A:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=mydey047skc:DkmDDXxcV_A:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/mydey047skc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/05/populating-an-extjs-datagrid-rowexpander-using-spring-mvc-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/05/populating-an-extjs-datagrid-rowexpander-using-spring-mvc-3/</feedburner:origLink></item>
		<item>
		<title>Ext Designer Review</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/-8yhBKJRH5U/</link>
		<comments>http://loianegroner.com/2010/04/ext-designer-review/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 10:40:35 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Ext Designer]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=344</guid>
		<description><![CDATA[A couple of weeks ago, I decided to download Ext Designer and play around with it. In this post, I am going to write a review about this application. Disclaimer: I am not being paid to do this and no one asked me to. Everything I say/write here is my honest opinion. Designer is a [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;">A couple of weeks ago, I decided to download <a href="http://www.extjs.com/products/designer/?ref=family" target="_blank">Ext Designer</a> and play around with it. In this post, I am going to write a review about this application.</p>
<p style="text-align: justify;"><em>Disclaimer: I am not being paid to do this and no one asked me to. Everything I say/write here is my honest opinion.</em></p>
<blockquote style="text-align: justify;"><p>Designer is a desktop application that helps you create interfaces faster than ever in an easy-to-use, drag-and-drop environment.</p></blockquote>
<p style="text-align: justify;">The ExtJS Team created a <a href="http://www.extjs.com/api/xds/screencasts/designer.html" target="_blank">Preview screencast</a> in which they mock up some interfaces.</p>
<p style="text-align: justify;">It really is cool. There is a <a href="http://www.extjs.com/blog/2009/10/08/ext-js-designer-preview/" target="_blank">post on ExtJS Blog</a> you can check out all the features of this great tool.</p>
<p style="text-align: justify;">Despite being a great tool with all those amazing features, there are some features and ExtJS components I missed in the application.</p>
<p style="text-align: justify;">First, I created a simple ExtJS application to illustrate what I mean.</p>
<p style="text-align: center;"><a href="http://loianegroner.com/wp-content/uploads/2010/04/Test_Ext_Designer_Loiane_01.gif" target="_blank"><img class="aligncenter size-full wp-image-348" title="Test_Ext_Designer_Loiane_01" src="http://loianegroner.com/wp-content/uploads/2010/04/Test_Ext_Designer_Loiane_01.gif" alt="Click to enlarge the picture" width="583" height="376" /></a></p>
<p style="text-align: justify;">It generates the code for each component you create:</p>
<p style="text-align: justify;"><strong>Personal Info – Field Set</strong>:</p>
<p style="text-align: center;"><a href="http://loianegroner.com/wp-content/uploads/2010/04/Test_Ext_Designer_Loiane_02.gif" target="_blank"><img class="size-full wp-image-349 aligncenter" title="Test_Ext_Designer_Loiane_02" src="http://loianegroner.com/wp-content/uploads/2010/04/Test_Ext_Designer_Loiane_02.gif" alt="Click to enlarge the picture" width="588" height="437" /></a></p>
<p style="text-align: justify;"><strong>Name Text Field</strong>:</p>
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/04/Test_Ext_Designer_Loiane_03.gif"><img class="aligncenter size-full wp-image-354" title="Test_Ext_Designer_Loiane_03" src="http://loianegroner.com/wp-content/uploads/2010/04/Test_Ext_Designer_Loiane_03.gif" alt="" width="588" height="437" /></a></p>
<p style="text-align: justify;">If you take a look, you will see the name text field within the personal info field set is declared in a different way.</p>
<p style="text-align: justify;">If you want to export the whole code to your favorite IDE, so you can integrate ExtJS with a programming language or platform (e.g.: PHP, Java, .NET), you just need to select the root component and click on &#8220;Export Code to Disk&#8221; or &#8220;Export code to ClipBoard&#8221;:</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/04/Test_Ext_Designer_Loiane_04.gif"><img class="aligncenter size-full wp-image-355" title="Test_Ext_Designer_Loiane_04" src="http://loianegroner.com/wp-content/uploads/2010/04/Test_Ext_Designer_Loiane_04.gif" alt="" width="184" height="399" /></a></p>
<p style="text-align: justify;">Look now at the code generated from the project I created – it is the same code you get when you choose the export function:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
MyWindowUi = Ext.extend(Ext.Window, {
    title: 'Ext Designer Test',
    width: 400,
    height: 250,
    initComponent: function() {
        this.items = [
            {
                xtype: 'tabpanel',
                activeTab: 1,
                items: [
                    {
                        xtype: 'panel',
                        title: 'Grid',
                        items: [
                            {
                                xtype: 'grid',
                                title: 'My Grid',
                                columns: [
                                    {
                                        xtype: 'gridcolumn',
                                        header: 'Name',
                                        sortable: true,
                                        resizable: true,
                                        width: 100,
                                        dataIndex: 'name'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        header: 'Phone #',
                                        sortable: true,
                                        resizable: true,
                                        width: 100,
                                        dataIndex: 'phone'
                                    },
                                    {
                                        xtype: 'gridcolumn',
                                        header: 'Address',
                                        sortable: true,
                                        resizable: true,
                                        width: 100,
                                        dataIndex: 'address'
                                    }
                                ],
                                bbar: {
                                    xtype: 'paging'
                                }
                            }
                        ]
                    },
                    {
                        xtype: 'panel',
                        title: 'Form',
                        items: [
                            {
                                xtype: 'fieldset',
                                title: 'Personal Info',
                                layout: 'form',
                                items: [
                                    {
                                        xtype: 'textfield',
                                        fieldLabel: 'Name',
                                        anchor: '100%',
                                        name: 'nameField'
                                    },
                                    {
                                        xtype: 'textarea',
                                        fieldLabel: 'Address',
                                        anchor: '100%',
                                        name: 'addressField'
                                    },
                                    {
                                        xtype: 'textfield',
                                        fieldLabel: 'Phone #',
                                        anchor: '100%',
                                        name: 'phoneField'
                                    }
                                ]
                            },
                            {
                                xtype: 'button',
                                text: 'Save'
                            }
                        ]
                    },
                    {
                        xtype: 'panel',
                        title: 'Tree',
                        items: [
                            {
                                xtype: 'treepanel',
                                title: 'My Tree',
                                root: {
                                    text: 'Root Node'
                                },
                                loader: {

                                }
                            }
                        ]
                    }
                ]
            }
        ];
        MyWindowUi.superclass.initComponent.call(this);
    }
});
</pre>
<p style="text-align: justify;">It generated a single code block! Lucky me it is a small and simple project! Imagine the code generated from a big project? Not friendly if you need to maintain this project in the future.</p>
<p style="text-align: justify;">This is the first thing I think they could improve in Ext Designer. If the tool creates a class for each component already, why do not use the reference to it to generate the whole code? And they could export all the classes in different files. I think this is the way most of ExtJS developers does when they have to develop a big project.</p>
<p style="text-align: justify;">The second thing I did not like is that the code is read only. I am a developer, and sometimes I just want to set a property in the code. It may be faster than searching the property in the Component Config tab, after all, I am used to set the properties in the code already. I understand this can be sort of a protection if a person does not know ExtJS and he/she can mess up with the code trying to change anything.</p>
<p style="text-align: justify;">Third: I missed some components, such as radio group and graphs, among others. Maybe this is something they can implement for a near future?</p>
<p style="text-align: justify;">The coolest feature in my opinion is the preview function. It is really awesome!</p>
<p style="text-align: justify;">In general, Ext Designer is a great tool and I love it! It is very intuitive.</p>
<p style="text-align: justify;">I do not recommend it if you are learning ExtJS. I think it is important to understand how ExtJS works and the components patterns before you get started with a visual tool. However, it is great if you are an ExtJS developer already. It can save you a lot of time. It is also great to prototype and design applications (if there is a design team in your company that do not know ExtJS programming).</p>
<p style="text-align: justify;">I definitely recommend buying it.</p>
<p style="text-align: justify;">You can <a href="http://www.extjs.com/products/designer/download.php" target="_blank">download the full version</a> (with all the features) and try it for 15 days for free (all you need to do is to <a href="http://www.extjs.com/forum/register.php" target="_blank">register as a user on the ExtJS forum</a>). After the evaluation period, you have to <a href="http://www.extjs.com/store/designer/" target="_blank">get a license</a>.</p>
<p style="text-align: justify;">Happy coding!</p>
<p style="text-align: justify;"><em>Updated</em>: ExtJS quoted this review on ExtJS Notes (Thank You!) &#8211; <a href="http://notes.extjs.com/post/501611295/ext-designer-is-a-great-tool" target="_blank">http://notes.extjs.com/post/501611295/ext-designer-is-a-great-tool</a></p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=344&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-8yhBKJRH5U:ERx1_g2aEiw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-8yhBKJRH5U:ERx1_g2aEiw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-8yhBKJRH5U:ERx1_g2aEiw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=-8yhBKJRH5U:ERx1_g2aEiw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-8yhBKJRH5U:ERx1_g2aEiw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-8yhBKJRH5U:ERx1_g2aEiw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=-8yhBKJRH5U:ERx1_g2aEiw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=-8yhBKJRH5U:ERx1_g2aEiw:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/-8yhBKJRH5U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/04/ext-designer-review/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/04/ext-designer-review/</feedburner:origLink></item>
		<item>
		<title>ExtJS and Spring MVC Framework: CRUD DataGrid Example</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/0llvUFas91Q/</link>
		<comments>http://loianegroner.com/2010/03/extjs-and-spring-mvc-framework-crud-datagrid-example/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 12:49:55 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[CRUD Grid]]></category>
		<category><![CDATA[DataDrop]]></category>
		<category><![CDATA[Ext.data.JsonWriter]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[ExtJS Grid]]></category>
		<category><![CDATA[json-lib-ext-spring]]></category>
		<category><![CDATA[RowEditor]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring MVC]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=329</guid>
		<description><![CDATA[This tutorial will walk through how to implement a CRUD (Create, Read, Update, Delete) DataGrid using ExtJS and Spring Framework. What do we usually want to do with data? Create (Insert) Read / Retrieve (Select) Update (Update) Delete / Destroy (Delete) Until ExtJS 3.0 we only could READ data using a dataGrid. If you wanted [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/03/extjs_spring_crud_grid.png"><img class="aligncenter size-full wp-image-335" title="extjs_spring_crud_grid" src="http://loianegroner.com/wp-content/uploads/2010/03/extjs_spring_crud_grid.png" alt="" width="664" height="351" /></a></p>
<p style="text-align: justify;">This tutorial will walk through how to implement a CRUD (Create, Read, Update, Delete) DataGrid using ExtJS and Spring Framework.</p>
<p style="text-align: justify;">What do we usually want to do with data?</p>
<ul style="text-align: justify;">
<li>Create      (Insert)</li>
<li>Read      / Retrieve (Select)</li>
<li>Update      (Update)</li>
<li>Delete      / Destroy (Delete)</li>
</ul>
<p style="text-align: justify;">Until ExtJS 3.0 we only could READ data using a dataGrid. If you wanted to update, insert or delete, you had to do some code to make these actions work. Now ExtJS 3.0 (and newest versions) introduces the ext.data.writer, and you do not need all that work to have a CRUD Grid.</p>
<p style="text-align: justify;">So… What do I need to add in my code to make all these things working together?</p>
<p style="text-align: justify;">In this example, I’m going to use JSON as data format exchange between the browser and the server.</p>
<p style="text-align: justify;">First, you need an Ext.data.JsonWriter:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
 // The new DataWriter component.
    var writer = new Ext.data.JsonWriter({
        encode: true,
        writeAllFields: false
    });
</pre>
<p>Where writeAllFields identifies that we want to write all the fields from the record to the database. If you have a fancy ORM then maybe you can set this to false.  For example. This is my record type declaration:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var Contact = Ext.data.Record.create([
	{name: 'id'},
    {
        name: 'name',
        type: 'string'
    }, {
        name: 'phone',
        type: 'string'
    }, {
        name: 'email',
        type: 'string'
    }, {
        name: 'birthday',
        type: 'date',
        dateFormat: 'm/d/Y'
    }]);
</pre>
<p style="text-align: justify;">If I only update the name of any contact in the datagrid, the app will only send the contact id and contact name back to server. In another words, the app will only send the updated data to the server + id (in update cases) and only the contact id in delete cases. Try to change it to true and enable Firebug plugin in your browser to see what happens.  Now you need to setup a proxy like this one:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var proxy = new Ext.data.HttpProxy({
        api: {
            read : 'contact/view.action',
            create : 'contact/create.action',
            update: 'contact/update.action',
            destroy: 'contact/delete.action'
        }
    });
</pre>
<p>FYI, this is how my reader looks like:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var reader = new Ext.data.JsonReader({
        totalProperty: 'total',
        successProperty: 'success',
        idProperty: 'id',
        root: 'data',
        messageProperty: 'message'  // &lt;-- New &quot;messageProperty&quot; meta-data
    },
    Contact);
</pre>
<p>The Writer and the proxy (and the reader) can be hooked to the store like this:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
 // Typical Store collecting the Proxy, Reader and Writer together.
    var store = new Ext.data.Store({
        id: 'user',
        proxy: proxy,
        reader: reader,
        writer: writer,  // &lt;-- plug a DataWriter into the store just as you would a Reader
        autoSave: false // &lt;-- false would delay executing create, update, destroy requests until specifically told to do so with some [save] buton.
    });
</pre>
<p style="text-align: justify;">Where autosave identifies if you want the data in automatically saving mode (you do not need a save button, the app will send the actions automatically to the server). In this case, I implemented a save button, so every record with new or updated value will have a red  mark on the cell left up corner).  When the user alters a value in the grid, then a &#8220;save&#8221; event occurs (if autosave is true). Upon the &#8220;save&#8221; event the grid determines which cells has been altered. When we have an altered cell, then the corresponding record is sent to the server with the &#8216;root&#8217; from the reader around it. E.g if we read with root &#8220;data&#8221;, then we send back with root &#8220;data&#8221;. We can have several records being sent at once. When updating to the server (e.g multiple edits).  And to make you life even easier, let’s use the RowEditor plugin, so you can easily edit or add new records. All you have to do is to add the css and js files in your page:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;!-- Row Editor plugin css --&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-crud-grid/ext-3.1.1/examples/ux/css/rowEditorCustom.css&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-crud-grid/ext-3.1.1/examples/shared/examples.css&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-crud-grid/ext-3.1.1/examples/ux/css/RowEditor.css&quot; /&gt;

&lt;!-- Row Editor plugin js --&gt;
	&lt;script src=&quot;/extjs-crud-grid/ext-3.1.1/examples/ux/RowEditor.js&quot;&gt;&lt;/script&gt;
</pre>
<p>Add the plugin on you grid declaration:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
    var editor = new Ext.ux.grid.RowEditor({
        saveText: 'Update'
    });

    // create grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        columns: [
            {header: &quot;NAME&quot;,
             width: 170,
             sortable: true,
             dataIndex: 'name',
             editor: {
                xtype: 'textfield',
                allowBlank: false
            }},
            {header: &quot;PHONE #&quot;,
             width: 150,
             sortable: true,
             dataIndex: 'phone',
             editor: {
                 xtype: 'textfield',
                 allowBlank: false
            }},
            {header: &quot;EMAIL&quot;,
             width: 150,
             sortable: true,
             dataIndex: 'email',
             editor: {
                xtype: 'textfield',
                allowBlank: false
            }},
            {header: &quot;BIRTHDAY&quot;,
             width: 100,
             sortable: true,
             dataIndex: 'birthday',
             renderer: Ext.util.Format.dateRenderer('m/d/Y'),
             editor: new Ext.form.DateField ({
                allowBlank: false,
                format: 'm/d/Y',
                maxValue: (new Date())
            })}
        ],
        plugins: [editor],
        title: 'My Contacts',
        height: 300,
        width:610,
		frame:true,
		tbar: [{
            iconCls: 'icon-user-add',
            text: 'Add Contact',
            handler: function(){
                var e = new Contact({
                    name: 'New Guy',
                    phone: '(000) 000-0000',
                    email: 'new@loianetest.com',
                    birthday: '01/01/2000'
                });
                editor.stopEditing();
                store.insert(0, e);
                grid.getView().refresh();
                grid.getSelectionModel().selectRow(0);
                editor.startEditing(0);
            }
        },{
            iconCls: 'icon-user-delete',
            text: 'Remove Contact',
            handler: function(){
                editor.stopEditing();
                var s = grid.getSelectionModel().getSelections();
                for(var i = 0, r; r = s[i]; i++){
                    store.remove(r);
                }
            }
        },{
            iconCls: 'icon-user-save',
            text: 'Save All Modifications',
            handler: function(){
                store.save();
            }
        }]
    });
</pre>
<p>Finally, you need some server side code. This is how my Controller looks like:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.web;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import com.loiane.model.Contact;
import com.loiane.service.ContactService;

public class ContactController extends MultiActionController  {

	private ContactService contactService;

	public ModelAndView view(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		try{

			List&lt;Contact&gt; contacts = contactService.getContactList();

			return getModelMap(contacts);

		} catch (Exception e) {

			return getModelMapError(&quot;Error trying to retrieve contacts.&quot;);
		}
	}

	public ModelAndView create(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		try{

			Object data = request.getParameter(&quot;data&quot;);

			List&lt;Contact&gt; contacts = contactService.create(data);

			return getModelMap(contacts);

		} catch (Exception e) {

			return getModelMapError(&quot;Error trying to create contact.&quot;);
		}
	}

	public ModelAndView update(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		try{

			Object data = request.getParameter(&quot;data&quot;);

			List&lt;Contact&gt; contacts = contactService.update(data);

			return getModelMap(contacts);

		} catch (Exception e) {

			return getModelMapError(&quot;Error trying to update contact.&quot;);
		}
	}

	public ModelAndView delete(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		try{

			String data = request.getParameter(&quot;data&quot;);

			contactService.delete(data);

			Map&lt;String,Object&gt; modelMap = new HashMap&lt;String,Object&gt;(3);
			modelMap.put(&quot;success&quot;, true);

			return new ModelAndView(&quot;jsonView&quot;, modelMap);

		} catch (Exception e) {

			return getModelMapError(&quot;Error trying to delete contact.&quot;);
		}
	}

	/**
	 * Generates modelMap to return in the modelAndView
	 * @param contacts
	 * @return
	 */
	private ModelAndView getModelMap(List&lt;Contact&gt; contacts){

		Map&lt;String,Object&gt; modelMap = new HashMap&lt;String,Object&gt;(3);
		modelMap.put(&quot;total&quot;, contacts.size());
		modelMap.put(&quot;data&quot;, contacts);
		modelMap.put(&quot;success&quot;, true);

		return new ModelAndView(&quot;jsonView&quot;, modelMap);
	}

	/**
	 * Generates modelMap to return in the modelAndView in case
	 * of exception
	 * @param msg message
	 * @return
	 */
	private ModelAndView getModelMapError(String msg){

		Map&lt;String,Object&gt; modelMap = new HashMap&lt;String,Object&gt;(2);
		modelMap.put(&quot;message&quot;, msg);
		modelMap.put(&quot;success&quot;, false);

		return new ModelAndView(&quot;jsonView&quot;,modelMap);
	}

	/**
	 * Spring use - DI
	 * @param dadoService
	 */
	public void setContactService(ContactService contactService) {
		this.contactService = contactService;
	}

}
</pre>
<p>If you want to see all the code (complete project will all the necessary files to run this app), download it from my GitHub repository: <a href="http://github.com/loiane/extjs-crud-grid" target="_blank">http://github.com/loiane/extjs-crud-grid</a></p>
<p>I just want to make one more observation: You can also use dataWriter to save the data dragged from an excel file and dropped into the grid (<a href="http://loianegroner.com/2010/03/importing-an-excel-spreadsheet-into-an-extjs-datagrid-using-datadrop-grid-plugin/" target="_blank">remember DataDrop plugin?</a>). I also included this plugin in this code project (<a href="http://github.com/loiane/extjs-crud-grid" target="_blank">check out my Github repository</a>).</p>
<p>Happy coding!</p>
<address><strong><span style="color: #000080;">Updated: I posted a new CRUD DataGrid example, using Spring MVC 3 and Hibernate 3.5: </span></strong><a href="http://loianegroner.com/2010/09/extjs-spring-mvc-3-and-hibernate-3-5-crud-datagrid-example/" target="_blank"><strong><span style="color: #000080;">http://loianegroner.com/2010/09/extjs-spring-mvc-3-and-hibernate-3-5-crud-datagrid-example/</span></strong></a></address>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=329&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=0llvUFas91Q:2hAD3nmWdRc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=0llvUFas91Q:2hAD3nmWdRc:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=0llvUFas91Q:2hAD3nmWdRc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=0llvUFas91Q:2hAD3nmWdRc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=0llvUFas91Q:2hAD3nmWdRc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=0llvUFas91Q:2hAD3nmWdRc:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=0llvUFas91Q:2hAD3nmWdRc:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=0llvUFas91Q:2hAD3nmWdRc:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/0llvUFas91Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/03/extjs-and-spring-mvc-framework-crud-datagrid-example/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/03/extjs-and-spring-mvc-framework-crud-datagrid-example/</feedburner:origLink></item>
		<item>
		<title>Quick Tip: Unix-VI Cheat Sheets</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/PNbIZOGTM_g/</link>
		<comments>http://loianegroner.com/2010/03/quick-tip-unix-vi-cheat-sheets/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 17:36:45 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[UNIX]]></category>
		<category><![CDATA[AIX]]></category>
		<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[Vi]]></category>
		<category><![CDATA[Vi Editor]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=320</guid>
		<description><![CDATA[Earlier this week, I started to play around Unix/Aix. I have to confess: I was very confused with all those commands that are anything intuitive. I was looking like those people that have never turned a computer on before, and you have to teach them how to use a mouse and how to move the cursor [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://loianegroner.com/wp-content/uploads/2010/03/3cheating.jpg"><img class="aligncenter size-full wp-image-326" title="3cheating" src="http://loianegroner.com/wp-content/uploads/2010/03/3cheating.jpg" alt="" width="393" height="261" /></a></p>
<p>Earlier this week, I started to play around <strong>Unix/Aix</strong>. I have to confess: I was very confused with all those commands that are anything intuitive.</p>
<p>I was looking like those people that have never turned a computer on before, and you have to teach them how to use a mouse and how to move the cursor around the screen. Totally newbie.</p>
<p>I definitely need those cheat sheets I can reference when I&#8217;m working on the command line environment.</p>
<p>So I goggled it and I found some interesting cheat sheets/ref cards. Following are some links that helped me (in case you need it as well):</p>
<object width="425" height="348"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=dd-unixcheatsheet-100317121119-phpapp01"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=dd-unixcheatsheet-100317121119-phpapp01"  type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="348"></embed></object>
<object width="425" height="348"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=dd-vieditorcheatsheet-100317121328-phpapp02"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=dd-vieditorcheatsheet-100317121328-phpapp02"  type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="348"></embed></object>
<object width="425" height="348"><param name="movie" value="http://static.slideshare.net/swf/ssplayerd.swf?doc=vicheatsheet-100317121048-phpapp01"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayerd.swf?doc=vicheatsheet-100317121048-phpapp01"  type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="348"></embed></object>
<object width="425" height="348"><param name="movie" value="http://static.slideshare.net/swf/ssplayerd.swf?doc=bashvieditingmodecheatsheet-100317122507-phpapp02"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayerd.swf?doc=bashvieditingmodecheatsheet-100317122507-phpapp02"  type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="348"></embed></object>
<p><strong>References:</strong></p>
<p><a href="http://www.atmos.albany.edu/deas/atmclasses/atm350/vi_cheat_sheet.pdf" target="_blank">vi Editor “Cheat Sheet”</a><br />
<a href="http://www.scottklarr.com/topic/115/linux-unix-cheat-sheets---the-ultimate-collection/" target="_blank"> Linux-Unix cheat sheets &#8211; The ultimate collection</a><br />
<a href="http://www.devdaily.com/blog/post/page-1/unix-vi-editor-cheat-sheets" target="_blank"> Free Unix/Linux and vi/vim cheat sheets</a></p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=320&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PNbIZOGTM_g:BLYDV1bBkcg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PNbIZOGTM_g:BLYDV1bBkcg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PNbIZOGTM_g:BLYDV1bBkcg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=PNbIZOGTM_g:BLYDV1bBkcg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PNbIZOGTM_g:BLYDV1bBkcg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PNbIZOGTM_g:BLYDV1bBkcg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=PNbIZOGTM_g:BLYDV1bBkcg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PNbIZOGTM_g:BLYDV1bBkcg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/PNbIZOGTM_g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/03/quick-tip-unix-vi-cheat-sheets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/03/quick-tip-unix-vi-cheat-sheets/</feedburner:origLink></item>
		<item>
		<title>Importing an Excel Spreadsheet into an ExtJS DataGrid using DataDrop Grid Plugin</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/nkHB0GGgt68/</link>
		<comments>http://loianegroner.com/2010/03/importing-an-excel-spreadsheet-into-an-extjs-datagrid-using-datadrop-grid-plugin/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 10:30:35 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[ExtJS Grid]]></category>
		<category><![CDATA[ExtJS Plugin]]></category>
		<category><![CDATA[import excel to grid]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=301</guid>
		<description><![CDATA[This tutorial will walk through how to import an Excel Spreadsheet into a DataGrid using DataDrop Plugin (by Shea Freaderick). Last week I was looking for a plugin that would allow me to import data from an excel file. I did not find any plugin on ExtJS forum that works like export excel from grid; [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/03/extjs_datadrop_excel_grid_plugin.jpg"><img class="aligncenter size-full wp-image-311" title="extjs_datadrop_excel_grid_plugin" src="http://loianegroner.com/wp-content/uploads/2010/03/extjs_datadrop_excel_grid_plugin.jpg" alt="" width="749" height="396" /></a></p>
<p style="text-align: justify;">This tutorial will walk through how to import an Excel Spreadsheet into a DataGrid using DataDrop Plugin (by <a href="http://www.vinylfox.com/" target="_blank">Shea Freaderick</a>).</p>
<p style="text-align: justify;">Last week I was looking for a plugin that would allow me to import data from an excel file.</p>
<p style="text-align: justify;">I did not find any plugin on <a href="http://www.extjs.com/forum/" target="_blank">ExtJS forum</a> that works like <a href="http://loianegroner.com/2010/02/extjs-how-to-export-datagrid-to-excel/" target="_blank">export excel from grid</a>; I mean, a plugin I do not need any server side code – I could use <a href="http://loianegroner.com/2010/03/ajax-file-upload-with-extjs-and-spring-framework/" target="_blank">file upload plugin</a> and do the whole logic thing on server side, but that is not what I was looking for. However, I did find an interesting plugin. Actuality, this plugin I found is awesome! The coolest ExtJS grid plugin I have ever seen! It is really amazing!</p>
<p style="text-align: justify;">So, what is this plugin I am talking a lot about it?</p>
<p style="text-align: justify;">It is called <a href="http://www.vinylfox.com/datadrop-drag-grid-data-from-spreadsheet/" target="_blank">DataDrop</a> developed by <a href="http://www.vinylfox.com/" target="_blank">Shea Frederick</a> (a.k.a <a href="http://www.vinylfox.com/" target="_blank">VinylFox</a>) and you can drag data into an ExtJS Datagrid from a spreadsheet.</p>
<p style="text-align: justify;">It is very helpful if you need to import some data from an Excel file. In my point of view, I think it is not good plugin if you need to import large amount of data, because it is not very practical to select a large amount of rows and columns from a spreadsheet. It works very well with any file size, though.</p>
<p style="text-align: justify;">What do you need to use this plugin?</p>
<p style="text-align: justify;">1 &#8211; Download plugin from author’s repository (<a href="http://code.google.com/p/ext-ux-datadrop/" target="_blank">Google code</a>)</p>
<p style="text-align: justify;">2 &#8211; Add javascript import to your html page (along with your other ExtJS imports)</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
	&lt;script src=&quot;/extjs-grid-dragdrop-excel/js/datadrop-plugin/Override.js&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;/extjs-grid-dragdrop-excel/js/datadrop-plugin/Ext.ux.DataDrop.js&quot;&gt;&lt;/script&gt;
</pre>
<p style="text-align: justify;">3 &#8211; Add “<em>Ext.ux.grid.DataDrop</em>” to your datagrid <em>plugins</em> declaration</p>
<pre class="brush: jscript; collapse: false; first-line: 1; highlight: [11]; toolbar: true; wrap-lines: false;">
    // create grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        columns: [
            {header: &quot;NAME&quot;, width: 170, sortable: true, dataIndex: 'name'},
            {header: &quot;PHONE #&quot;, width: 150, sortable: true, dataIndex: 'phone'},
            {header: &quot;EMAIL&quot;, width: 150, sortable: true, dataIndex: 'email'},
            {header: &quot;BIRTHDAY&quot;, width: 100, sortable: true, dataIndex: 'birthday',
            	renderer: Ext.util.Format.dateRenderer('m/d/Y')}
        ],
        plugins: [Ext.ux.grid.DataDrop],
        title: 'My Contacts',
        autoHeight:true,
        width:590,
		renderTo: document.body,
		frame:true
    });
</pre>
<p style="text-align: justify;">You can download a working example from my Github repository: <a href="http://github.com/loiane/extjs-grid-dragdrop-excel" target="_blank">http://github.com/loiane/extjs-grid-dragdrop-excel</a></p>
<p style="text-align: justify;">Other observations:</p>
<p style="text-align: justify;">On <a href="http://www.vinylfox.com/datadrop-drag-grid-data-from-spreadsheet/" target="_blank">VinylFox website</a>, there is a video that demonstrates how to use the plugin with Open Office.</p>
<p style="text-align: justify;">In my first attempt to run my example, I tried to select data from Microsoft Excel and drag and drop into datagrid, but I could not find how to do it (yes, I know, I’m totally M$ Excel newbie – just know how to do simple math – shame on me) – it is so easy to drag data from Open Office and Lotus Symphony – you can click on any place!</p>
<p style="text-align: justify;">If you are newbie just like me, I recorded a video demonstrating how to do it:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/Seq7rQgILvg&amp;hl=pt_BR&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/Seq7rQgILvg&amp;hl=pt_BR&amp;fs=1&amp;color1=0x2b405b&amp;color2=0x6b8ab6" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p style="text-align: justify;">Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=301&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=nkHB0GGgt68:HPLJgtmoLLg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=nkHB0GGgt68:HPLJgtmoLLg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=nkHB0GGgt68:HPLJgtmoLLg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=nkHB0GGgt68:HPLJgtmoLLg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=nkHB0GGgt68:HPLJgtmoLLg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=nkHB0GGgt68:HPLJgtmoLLg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=nkHB0GGgt68:HPLJgtmoLLg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=nkHB0GGgt68:HPLJgtmoLLg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/nkHB0GGgt68" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/03/importing-an-excel-spreadsheet-into-an-extjs-datagrid-using-datadrop-grid-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/03/importing-an-excel-spreadsheet-into-an-extjs-datagrid-using-datadrop-grid-plugin/</feedburner:origLink></item>
		<item>
		<title>Ajax File Upload with ExtJS and Spring Framework</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/7WKmgY5E4AA/</link>
		<comments>http://loianegroner.com/2010/03/ajax-file-upload-with-extjs-and-spring-framework/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 10:30:31 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[file upload]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=285</guid>
		<description><![CDATA[This tutorial will walk you through how to implement an ajax file upload form using ExtJS on client side and Spring Framework on server side. What are you going to need before start this tutorial? ExtJS Spring Framework (MVC) and its dependencies commons-io-1.4.jar commons-fileupload-1.2.jar First, you need to implement the ExtJS File Upload form. You [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: center;"><a href="http://loianegroner.com/wp-content/uploads/2010/02/file_upload_spring_extjs_loiane.png"><img class="aligncenter size-full wp-image-292" style="border: 1px solid black;" title="file_upload_spring_extjs_loiane" src="http://loianegroner.com/wp-content/uploads/2010/02/file_upload_spring_extjs_loiane.png" alt="" width="513" height="149" /></a></p>
<p>This tutorial will walk you through how to implement an ajax file upload form using ExtJS on client side and Spring Framework on server side.</p>
<p>What are you going to need before start this tutorial?</p>
<ul>
<li><a href="http://www.extjs.com/" target="_blank">ExtJS</a></li>
<li><a href="http://www.springsource.com/download/community" target="_blank">Spring Framework</a> (MVC) and its dependencies</li>
<li><a href="http://commons.apache.org/downloads/download_io.cgi" target="_blank">commons-io-1.4.jar</a></li>
<li><a href="http://commons.apache.org/downloads/download_fileupload.cgi" target="_blank">commons-fileupload-1.2.jar</a></li>
</ul>
<p>First, you need to implement the ExtJS File Upload form. You can use ExtJS <a href="http://www.extjs.com/deploy/dev/examples/form/file-upload.html" target="_blank">File Upload example</a> page to see how it looks like (I&#8217;m using third example).<br />
Bellow is the form I implemented (or copied from ExtJS and adapted it to my needs &#8211; spring):</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
Ext.onReady(function(){

    Ext.QuickTips.init();

    var msg = function(title, msg){
        Ext.Msg.show({
            title: title,
            msg: msg,
            minWidth: 200,
            modal: true,
            icon: Ext.Msg.INFO,
            buttons: Ext.Msg.OK
        });
    };

    var fp = new Ext.FormPanel({
        renderTo: 'fi-form',
        fileUpload: true,
        width: 500,
        frame: true,
        title: 'File Upload Form',
        autoHeight: true,
        bodyStyle: 'padding: 10px 10px 0 10px;',
        labelWidth: 50,
        defaults: {
            anchor: '95%',
            allowBlank: false,
            msgTarget: 'side'
        },
        items: [{
            xtype: 'fileuploadfield',
            id: 'form-file',
            emptyText: 'Select a File to import',
            fieldLabel: 'File',
            name: 'file',
            buttonCfg: {
                text: '',
                iconCls: 'upload-icon'
            }
        }],
        buttons: [{
            text: 'Upload',
            handler: function(){
                if(fp.getForm().isValid()){
	                fp.getForm().submit({
	                    url: 'fileUpload/import.action',
	                    waitMsg: 'Uploading your file...',
	                    success: function(fp, o){
	                        msg('Success', 'Processed file on the server');
	                    }
	                });
                }
            }
        },{
            text: 'Reset',
            handler: function(){
                fp.getForm().reset();
            }
        }]
    });

});
</pre>
<p>And here is an example of how to use it (html page):</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Spring FileUpload Example with ExtJS Form&lt;/title&gt;

    &lt;!-- Ext JS files --&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-file-import-spring/ext-3.1.1/resources/css/ext-all.css&quot; /&gt;

	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-file-import-spring/ext-3.1.1/examples/shared/examples.css&quot; /&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-file-import-spring/ext-3.1.1/examples/ux/fileuploadfield/css/fileuploadfield.css&quot;/&gt;

	&lt;style type=text/css&gt;
        .upload-icon {
            background: url('/extjs-file-import-spring/ext-3.1.1/examples/shared/icons/fam/image_add.png') no-repeat 0 0 !important;
        }
    &lt;/style&gt;

	&lt;script src=&quot;/extjs-file-import-spring/ext-3.1.1/adapter/ext/ext-base.js&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;/extjs-file-import-spring/ext-3.1.1/ext-all.js&quot;&gt;&lt;/script&gt;

	&lt;script src=&quot;/extjs-file-import-spring/ext-3.1.1/examples/ux/fileuploadfield/FileUploadField.js&quot;&gt;&lt;/script&gt;

	&lt;!-- file upload form --&gt;
	&lt;script src=&quot;/extjs-file-import-spring/js/file-upload.js&quot;&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

	&lt;h1&gt;Spring File Upload Example Integrated with ExtJS FileUpload Form&lt;/h1&gt;
	&lt;p&gt;Click on &quot;Browse&quot; button (image) to select a file and click on Upload button&lt;/p&gt;
	&lt;div id=&quot;fi-form&quot;&gt;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Before starting to code a FileUploadController, you are going to need a FileUploadBean:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.beans;

import org.springframework.web.multipart.MultipartFile;

public class FileUploadBean {

	private MultipartFile file;

	public MultipartFile getFile() {
		return file;
	}

	public void setFile(MultipartFile file) {
		this.file = file;
	}

}
</pre>
<p>And here is my FileUploadController (I am simply storing the uploaded file in a directory in my hard drive &#8211; C:). You can add some validation or process the file in this class. You can also add some message to return to client side in case of success or failure.</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.web;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.support.ByteArrayMultipartFileEditor;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import com.loiane.beans.FileUploadBean;

public class FileUploadController extends SimpleFormController  {

	protected ModelAndView onSubmit(
			HttpServletRequest request,
			HttpServletResponse response,
			Object command,
			BindException errors) throws ServletException, IOException {

		// cast the bean
		FileUploadBean bean = (FileUploadBean) command;

		MultipartFile file = bean.getFile();
		String fileName = null;

		if (file == null) {
			System.out.println(&quot;User Did not upload file&quot;);
		}
		else {
			System.out.println(&quot;Uploaded File Name is :&quot; + file.getOriginalFilename());
		}

		InputStream inputStream = null;
		OutputStream outputStream = null;
		if (file.getSize() &gt; 0) {
			inputStream = file.getInputStream();
			String root = &quot;C:\\&quot;;
			fileName = root + file.getOriginalFilename();
			outputStream = new FileOutputStream(fileName);
			int readBytes = 0;
			byte[] buffer = new byte[10000];
			while ((readBytes = inputStream.read(buffer, 0 , 10000))!=-1){

				outputStream.write(buffer, 0, readBytes);
			}
			outputStream.close();
			inputStream.close();
		}

		return null;

	}     

	protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder)
	throws ServletException {
		// to actually be able to convert Multipart instance to byte[]
		// we have to register a custom editor
		binder.registerCustomEditor(byte[].class, new ByteArrayMultipartFileEditor());
		// now Spring knows how to handle multipart object and convert them
	}

}
</pre>
<p>You also need to add this in your servelt.xml:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
	&lt;!-- max upload size in bytes --&gt;
     &lt;bean id=&quot;multipartResolver&quot; class=&quot;org.springframework.web.multipart.commons.CommonsMultipartResolver&quot;&gt;
     	&lt;property name=&quot;maxUploadSize&quot; value=&quot;1000000&quot;/&gt;
     &lt;/bean&gt;
</pre>
<p>Very simple!</p>
<p>Here is the source code of my example project: <a href="http://github.com/loiane/extjs-file-import-spring" target="_blank">http://github.com/loiane/extjs-file-import-spring</a></p>
<p>Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=285&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7WKmgY5E4AA:5zTKwh_kSyQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7WKmgY5E4AA:5zTKwh_kSyQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7WKmgY5E4AA:5zTKwh_kSyQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=7WKmgY5E4AA:5zTKwh_kSyQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7WKmgY5E4AA:5zTKwh_kSyQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7WKmgY5E4AA:5zTKwh_kSyQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=7WKmgY5E4AA:5zTKwh_kSyQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7WKmgY5E4AA:5zTKwh_kSyQ:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/7WKmgY5E4AA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/03/ajax-file-upload-with-extjs-and-spring-framework/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/03/ajax-file-upload-with-extjs-and-spring-framework/</feedburner:origLink></item>
		<item>
		<title>Book Review: Ext JS 3.0 Cookbook by Jorge Ramon</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/m7c5R-nDukA/</link>
		<comments>http://loianegroner.com/2010/02/book-review-ext-js-3-0-cookbook-by-jorge-ramon/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 11:00:55 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[Book Review]]></category>
		<category><![CDATA[ExtJS]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=259</guid>
		<description><![CDATA[In an effort to start off my New Year&#8217;s resolution of reading more technical books, today I am  going  to publish my first book review of this year. Let&#8217;s see how many books I am going to read until December/2010. I am going to start writing a review about the Ext JS 3.0 Cookbook by [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;"><a href="http://www.packtpub.com/ext-js-3-0-cookbook/book?utm_source=loianegroner.com&amp;utm_medium=bookrev&amp;utm_content=other&amp;utm_campaign=mdb_002272"><img class="alignleft size-full wp-image-265" title="ExtJS 3.0 Cookbook" src="http://loianegroner.com/wp-content/uploads/2010/02/1847198708.png" alt="" width="100" height="123" /></a>In an effort to start off my New Year&#8217;s resolution of reading more technical books, today I am  going  to publish my first book review of this year. Let&#8217;s see how many books I am going to read until December/2010.</p>
<p style="text-align: justify;">I am going to start writing a review about the <a href="http://www.packtpub.com/ext-js-3-0-cookbook/book?utm_source=loianegroner.com&amp;utm_medium=bookrev&amp;utm_content=other&amp;utm_campaign=mdb_002272" target="_blank">Ext JS 3.0 Cookbook</a> by Jorge Ramon, published by <a href="http://www.packtpub.com/" target="_blank">Packt Publishing</a>, who sent me a review copy of this book. This is my honest opinion about it.</p>
<h3 style="text-align: justify;">Motivation</h3>
<p style="text-align: justify;">As you can see, if you navigate through my blog, I am an ExtJS fan and I use it daily in my work.</p>
<p style="text-align: justify;">ExtJS website has a good set of basic examples, but if you need something more fancy, you have to spend some time until you find what you need or make some customizations.</p>
<p style="text-align: justify;">The good thing about this book is that is very hands on, and it is very practical, just like a cookbook. It’s literally “<strong>109 great recipes for building impressive rich internet applications</strong>”. It contains those special recipes you spend some time looking for on the Internet.</p>
<p style="text-align: justify;">I do not recommend this book if you are trying to learn ExtJS, you need to learn some ExtJS basics concepts to understand it.</p>
<p style="text-align: justify;">However, if you are somewhat familiar with ExtJS and you are looking to boost your knowledge about what the framework is capable of, this is a great recipe book,  and I <strong>definitely recommend it</strong>. The code is clean and readable. It’s a handy reference and a set of problem/answers that solve discrete problems.</p>
<h3 style="text-align: justify;">Format of this book</h3>
<p style="text-align: justify;">This book is labeled as a cookbook, and it follows that convention quite well. There is a nice format for each recipe that mostly follows:</p>
<ol style="text-align: justify;">
<li>Definition/explanation      of the recipe &#8211; an introduction of the problem</li>
<li>The <strong>How      to do it…</strong>… section</li>
<li>The <strong>How      it works…</strong> section</li>
<li>The <strong>There’s      more…</strong> section</li>
<li>The <strong>See      also…</strong> section</li>
</ol>
<p style="text-align: justify;">This reoccurring pattern really helps you quickly find what you’re looking for, especially when you’re using the recipe as a refresher as opposed to initial discovery.</p>
<h3 style="text-align: justify;">My opinion about this book</h3>
<p style="text-align: justify;">It does what it says it is on the cover, and it is well organized, well written and consistent.</p>
<p style="text-align: justify;">The book is focused: there is no long introduction (personally, I <em>hate</em> books with long introductions).</p>
<p style="text-align: justify;">The “<em>How to do it…</em>” sections are is step-by-step, <em>and</em> explaining what each step does.</p>
<p style="text-align: justify;">The book covers excellent examples using components provided by ExtJS framework.</p>
<p style="text-align: justify;">As a cookbook, I think it missed some tips of <em>third party plug-ins</em> (and this is something I did not find in any ExtJS book), just like in JQuery page (maybe this is an idea for another book? <img src='http://loianegroner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ).</p>
<h3 style="text-align: justify;">Conclusion</h3>
<p style="text-align: justify;">This book is a great reference for those who work with ExtJS everyday. This is one of the best books I have read about ExtJS. It is worth to have it.</p>
<p style="text-align: justify;">You can check out a <a href="http://www.packtpub.com/files/8709-ext-js-cookbook-sample-chapter-3-load-validate-and-submit-forms.pdf" target="_blank">sample chapter of Ext JS 3.0 Cookbook</a>.</p>
<p style="text-align: justify;">And this is the<a href="http://www.packtpub.com/ext-js-3-0-cookbook/book?utm_source=loianegroner.com&amp;utm_medium=bookrev&amp;utm_content=other&amp;utm_campaign=mdb_002272" target="_blank"> link to the book page</a>.</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=259&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=m7c5R-nDukA:gJjKC6nLGcY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=m7c5R-nDukA:gJjKC6nLGcY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=m7c5R-nDukA:gJjKC6nLGcY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=m7c5R-nDukA:gJjKC6nLGcY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=m7c5R-nDukA:gJjKC6nLGcY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=m7c5R-nDukA:gJjKC6nLGcY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=m7c5R-nDukA:gJjKC6nLGcY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=m7c5R-nDukA:gJjKC6nLGcY:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/m7c5R-nDukA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/02/book-review-ext-js-3-0-cookbook-by-jorge-ramon/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/02/book-review-ext-js-3-0-cookbook-by-jorge-ramon/</feedburner:origLink></item>
		<item>
		<title>Spring MVC and AJAX with JSON</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/PSUCfsq8joQ/</link>
		<comments>http://loianegroner.com/2010/02/spring-mvc-and-ajax-with-json/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 11:43:23 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Json-lib]]></category>
		<category><![CDATA[json-lib-ext-spring]]></category>
		<category><![CDATA[Spring MVC]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=237</guid>
		<description><![CDATA[This tutorial will walk through how to configure Spring MVC to return a JSON object to client browser. One of the main decisions to be taken while developing AJAX applications is the format of messages passed by the server to the client browser. There are many options to choose from including plain text, XML, CSV [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/02/spring-json_loiane.jpg"><img class="aligncenter size-full wp-image-275" title="spring-json_loiane" src="http://loianegroner.com/wp-content/uploads/2010/02/spring-json_loiane.jpg" alt="" width="478" height="131" /></a>This tutorial will walk through how to configure Spring MVC to return a JSON object to client browser.</p>
<div id="_mcePaste" style="text-align: justify;">One of the main decisions to be taken while developing AJAX applications is the format of messages passed by the server to the client browser. There are many options to choose from including plain text, XML, CSV etc. One of the more popular choices today is the JavaScript Object Notation (JSON). JSON provides a nice name-value pair data format that is easy to generate and parse.</div>
<p style="text-align: justify;"><em>How to do it?</em></p>
<p style="text-align: justify;">You can use <a href="http://sourceforge.net/project/showfiles.php?group_id=171425" target="_blank">json-lib-ext-spring</a>. There are other libs, this is the one I found. If you know or use another one, please leave a comment with the library name. <img src='http://loianegroner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: justify;">Do not forget to download <a href="http://sourceforge.net/project/showfiles.php?group_id=171425">Json-lib</a> and its dependencies.</p>
<p style="text-align: justify;">Now you have to configure your XML files:</p>
<p style="text-align: justify;">Create a <strong>views.xml</strong> file under WEB-INF folder and paste the following code into it:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xmlns:util=&quot;http://www.springframework.org/schema/util&quot;
    xsi:schemaLocation= &quot;http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

http://www.springframework.org/schema/util

http://www.springframework.org/schema/util/spring-util-2.5.xsd&quot;&gt;

 &lt;bean name=&quot;jsonView&quot; class=&quot;net.sf.json.spring.web.servlet.view.JsonView&quot; /&gt;

&lt;/beans&gt;
</pre>
<p style="text-align: justify;">Add this config to you spring configuration file:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;!-- json --&gt;
&lt;bean id=&quot;xmlFileViewResolver&quot; class=&quot;org.springframework.web.servlet.view.XmlViewResolver&quot;&gt;
	&lt;property name=&quot;location&quot;&gt;
		&lt;value&gt;/WEB-INF/views.xml&lt;/value&gt;
	&lt;/property&gt;
	&lt;property name=&quot;order&quot;&gt;
		&lt;value&gt;1&lt;/value&gt;
	&lt;/property&gt;
&lt;/bean&gt;
</pre>
<p style="text-align: justify;">Make sure to set the order if you are using any other view resolvers.</p>
<p style="text-align: justify;">Now you just have to use &#8220;jsonView&#8221; as the viewname and the model will be converted to JSONbefore being sent back to the client:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
return new ModelAndView(&quot;jsonView&quot;, modelMap);
</pre>
<p style="text-align: left;">Here is an example:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
	public ModelAndView getColumnsJson(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		Map&lt;String,Object&gt; modelMap = new HashMap&lt;String,Object&gt;(2);
		modelMap.put(&quot;rows&quot;, service.generateColumns());
		return new ModelAndView(&quot;jsonView&quot;, modelMap);

	}
</pre>
<p style="text-align: justify;">Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=237&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PSUCfsq8joQ:WtbHx2e9W2c:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PSUCfsq8joQ:WtbHx2e9W2c:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PSUCfsq8joQ:WtbHx2e9W2c:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=PSUCfsq8joQ:WtbHx2e9W2c:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PSUCfsq8joQ:WtbHx2e9W2c:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PSUCfsq8joQ:WtbHx2e9W2c:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=PSUCfsq8joQ:WtbHx2e9W2c:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=PSUCfsq8joQ:WtbHx2e9W2c:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/PSUCfsq8joQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/02/spring-mvc-and-ajax-with-json/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/02/spring-mvc-and-ajax-with-json/</feedburner:origLink></item>
		<item>
		<title>ExtJS: How to Export DataGrid to Excel</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/5A9znv4pA2g/</link>
		<comments>http://loianegroner.com/2010/02/extjs-how-to-export-datagrid-to-excel/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 11:06:36 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[export grid to Excel]]></category>
		<category><![CDATA[ExtJS Grid]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=222</guid>
		<description><![CDATA[This tutorial will walk through how to export data from ExtJS DataGrid directly to Excel. Sometimes the user wants to export the data from the datagrid to an excel file. There is an ExtJS third party plugin that does it for you. There are some &#8220;issues&#8221; you have to be aware of before you start: [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/01/extjs_export_gridpanel_excel.png"><img class="aligncenter size-full wp-image-229" title="extjs_export_gridpanel_excel" src="http://loianegroner.com/wp-content/uploads/2010/01/extjs_export_gridpanel_excel.png" alt="" width="599" height="340" /></a></p>
<p style="text-align: justify;">This tutorial will walk through how to export data from ExtJS DataGrid directly to Excel.</p>
<p style="text-align: justify;">Sometimes the user wants to export the data from the datagrid to an excel file. There is an ExtJS <a href="http://www.extjs.com/forum/showthread.php?t=32400" target="_blank">third party plugin</a> that does it for you.</p>
<p style="text-align: justify;">There are some &#8220;issues&#8221; you have to be aware of before you start:</p>
<ul style="text-align: justify;">
<li>It needs a browser that supports <a href="http://en.wikipedia.org/wiki/Data_URI_scheme" target="_blank">data URLs</a>, such as Firefox, Opera and IE<strong>8</strong>.</li>
<li>I tested it with the following ExtJS versions: 2.2.1, 3.0, 3.0.3 and 3.1, but it only worked with ExtJS 3.0. If anyone is using other ExtJS version and the plugin worked, please, let me know.</li>
<li>It only works on the data in the Store &#8211; if you are using server-side paging, then perform this processing on the server. For quick and dirty conversion of a small table to Excel, this might be useful.</li>
<li>If the data in the Store is volatile (It gets reloaded or edited), the data URL will have to be recalculated.</li>
</ul>
<p style="text-align: justify;">Let&#8217;s get started:</p>
<p style="text-align: justify;">First, create a file in your projet and paste this content in it (I called it exporter.js): <a href="http://github.com/loiane/extjs-export-excel/blob/master/WebContent/js/exporter.js" target="_blank">http://github.com/loiane/extjs-export-excel/blob/master/WebContent/js/exporter.js</a> (this file has too many lines, that&#8217;s why I&#8217;m not going to past its content here).</p>
<p style="text-align: justify;">Then, in your datagrid, add this code:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
var linkButton = new Ext.LinkButton({
        id: 'grid-excel-button',
        text: 'Export to Excel'
});

//create the Grid
var grid = new Ext.grid.GridPanel({
    bbar: new Ext.Toolbar({
        buttons: [linkButton]
    })
});

linkButton.getEl().child('a', true).href = 'data:application/vnd.ms-excel;base64,' +
Base64.encode(grid.getExcelXml());
</pre>
<p style="text-align: justify;">And if you try to export the data, it will look like this:</p>
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/01/extjs_export_gridpanel_excel_file.png"><img class="aligncenter size-full wp-image-230" title="extjs_export_gridpanel_excel_file" src="http://loianegroner.com/wp-content/uploads/2010/01/extjs_export_gridpanel_excel_file.png" alt="" width="627" height="359" /></a></p>
<p style="text-align: justify;">Feel free to change the color, fonts. Take a look in the code and try to understand it to make the changes you want.</p>
<p style="text-align: justify;"><a title="Ed Spencer" href="http://edspencer.net/" target="_blank">Ed Spencer</a> also developed a <a title="similar plugin" href="http://github.com/edspencer/Ext.ux.Exporter" target="_blank">similar plugin</a>. The source code is cleaner than this one. The output is the same, though.</p>
<p style="text-align: justify;">You can download my sample app from my GitHub repository (JEE project): <a href="http://github.com/loiane/extjs-export-excel" target="_blank">http://github.com/loiane/extjs-export-excel</a></p>
<p style="text-align: justify;">Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=222&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=5A9znv4pA2g:ttrjZnVgQ50:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=5A9znv4pA2g:ttrjZnVgQ50:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=5A9znv4pA2g:ttrjZnVgQ50:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=5A9znv4pA2g:ttrjZnVgQ50:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=5A9znv4pA2g:ttrjZnVgQ50:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=5A9znv4pA2g:ttrjZnVgQ50:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=5A9znv4pA2g:ttrjZnVgQ50:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=5A9znv4pA2g:ttrjZnVgQ50:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/5A9znv4pA2g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/02/extjs-how-to-export-datagrid-to-excel/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/02/extjs-how-to-export-datagrid-to-excel/</feedburner:origLink></item>
		<item>
		<title>Integrating Spring Security with ExtJS Login Page</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/qiKbU5DGWQc/</link>
		<comments>http://loianegroner.com/2010/02/integrating-spring-security-with-extjs-login-page/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 10:00:28 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring Security]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[ExtJS Login Form]]></category>
		<category><![CDATA[Spring Security Login]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=210</guid>
		<description><![CDATA[This tutorial will walk through how to configure ExtJS Login form (Ajax login form) instead of default Spring Security login.jsp. Instead of using login.jsp from spring security, why do not use an ajax login form? And How to integrate the ExtJS Login Form with Spring Security? You did try to do it, the user is [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: center;"><a href="http://loianegroner.com/wp-content/uploads/2010/01/spring_security_extjs_login.png" target="_blank"><img class="aligncenter size-full wp-image-212" title="spring_security_extjs_login" src="http://loianegroner.com/wp-content/uploads/2010/01/spring_security_extjs_login.png" alt="" width="445" height="257" /></a></p>
<p>This tutorial will walk through how to configure <a href="http://www.extjs.com/" target="_blank">ExtJS</a> Login form (Ajax login form) instead of default Spring Security login.jsp.</p>
<p>Instead of using login.jsp from spring security, why do not use an ajax login form?</p>
<p>And How to integrate the <a href="http://www.extjs.com/" target="_blank">ExtJS</a> Login Form with <a href="http://static.springsource.org/spring-security/site/" target="_blank">Spring Security</a>?</p>
<p>You did try to do it, the user is successfully authenticated, but the user is not redirected to the application main page. How to fix this situation? How to make it work?</p>
<p>It does not matter if you set the default-target-url in applicationContext-security.xml, or set a redirect URL on server side. It will not work this way.</p>
<p>The issue is that <a href="http://www.extjs.com/" target="_blank">ExtJS</a> make Ajax calls, and no redirect will work on server side. You have to redirect it on the client side, which is the ExtJS/javascript code.</p>
<p>First, you need to create the login form. You can use the <a href="http://www.extjs.com/learn/Tutorial:Basic_Login" target="_blank">javascript code provided by ExtJS</a> and you can modify it to work with spring security.</p>
<p>If you take a look at the login.jsp, you will see three key points:</p>
<ol>
<li>URL / form action: <strong>j_spring_security_check</strong></li>
<li>Username input name: <strong>j_username</strong></li>
<li>Password input name: <strong>j_password</strong></li>
</ol>
<p>That is what you need to customize to make ExtJS Login form works! But do not be too comfortable, there are some issues you need to fix to make it work perfectly.</p>
<p>Take a look how login.js looks like (after customization):</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
Ext.onReady(function(){
	Ext.QuickTips.init();

	// Create a variable to hold our EXT Form Panel.

	// Assign various config options as seen.
	var login = new Ext.FormPanel({
		labelWidth:80,
		url:'j_spring_security_check',
		frame:true,
		title:'Please Login',

		defaultType:'textfield',
		width:300,
		height:150,
		monitorValid:true,
		// Specific attributes for the text fields for username / password.
		// The &quot;name&quot; attribute defines the name of variables sent to the server.

		items:[{
			fieldLabel:'Username',
			name:'j_username',
			allowBlank:false
		},{
			fieldLabel:'Password',

			name:'j_password',
			inputType:'password',
			allowBlank:false
		}],

		// All the magic happens after the user clicks the button
		buttons:[{

			text:'Login',
			formBind: true,
			// Function that fires when user clicks the button
			handler:function(){
			login.getForm().submit({

				method:'POST',

				// Functions that fire (success or failure) when the server responds.
				// The server would actually respond with valid JSON,
				// something like: response.write &quot;{ success: true}&quot; or

				// response.write &quot;{ success: false, errors: { reason: 'Login failed. Try again.' }}&quot;
				// depending on the logic contained within your server script.
				// If a success occurs, the user is notified with an alert messagebox,

				// and when they click &quot;OK&quot;, they are redirected to whatever page
				// you define as redirect.

				success:function(){
				Ext.Msg.alert('Status', 'Login Successful!', function(btn, text){

					if (btn == 'ok'){
						window.location = 'main.action';
					}
				});

			},

			// Failure function, see comment above re: success and failure.
			// You can see here, if login fails, it throws a messagebox
			// at the user telling him / her as much.

			failure:function(form, action){
				if(action.failureType == 'server'){
					obj = Ext.util.JSON.decode(action.response.responseText);

					Ext.Msg.alert('Login Failed!', obj.errors.reason);
				}else{
					Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);

				}
				login.getForm().reset();
			}

			});
		}
		}]
	});

	login.render('login');

});
</pre>
<p>If you make these changes and try to execute the application with a basic <strong>applicationContext-security.xml</strong> file, the user will be successfully authenticated, but is not going to be redirected.</p>
<p>What are we missing then?</p>
<p>You need to customize <a href="http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/web/authentication/AuthenticationProcessingFilter.html" target="_blank"><strong>AuthenticationProcessingFilter</strong> </a>class for spring security to perform actions on login.</p>
<p>The “onSuccessfulAuthentication” and “onUnsuccessfulAuthentication” methods need to return some JSON content. If user is successfully authenticated, then redirect to main page, otherwise, the application will show an error message.</p>
<p>This is <strong>MyAuthenticationProcessingFilter</strong> class:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
package com.loiane.security;

import java.io.IOException;
import java.io.Writer;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationException;
import org.springframework.security.ui.webapp.AuthenticationProcessingFilter;

public class MyAuthenticationProcessingFilter extends AuthenticationProcessingFilter {

	protected void onSuccessfulAuthentication(HttpServletRequest request,
			HttpServletResponse response, Authentication authResult)
	throws IOException {
		super.onSuccessfulAuthentication(request, response, authResult);

		HttpServletResponseWrapper responseWrapper = new HttpServletResponseWrapper(response);

		Writer out = responseWrapper.getWriter();

		String targetUrl = determineTargetUrl( request );
		out.write(&quot;{success:true, targetUrl : \'&quot; + targetUrl + &quot;\'}&quot;);
		out.close();

	}

	protected void onUnsuccessfulAuthentication( HttpServletRequest request,
			HttpServletResponse response, AuthenticationException failed )
	throws IOException {

		HttpServletResponseWrapper responseWrapper = new HttpServletResponseWrapper(response);

		Writer out = responseWrapper.getWriter();

		out.write(&quot;{ success: false, errors: { reason: 'Login failed. Try again.' }}&quot;);
		out.close();

	}

}
</pre>
<p>And this is how <strong>applicationContext-security.xml <strong>looks like</strong>:</strong></p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
	xmlns:security=&quot;http://www.springframework.org/schema/security&quot;
	xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
	xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd&quot;&gt;

	&lt;security:global-method-security /&gt;

	&lt;security:http auto-config=&quot;false&quot; entry-point-ref=&quot;authenticationProcessingFilterEntryPoint&quot;&gt;
		&lt;security:intercept-url pattern=&quot;/index.jsp&quot; filters=&quot;none&quot; /&gt;
		&lt;security:intercept-url pattern=&quot;/*.action&quot; access=&quot;ROLE_USER&quot; /&gt;
	&lt;/security:http&gt;

	&lt;bean id=&quot;authenticationProcessingFilter&quot; class=&quot;com.loiane.security.MyAuthenticationProcessingFilter&quot;&gt;
		&lt;security:custom-filter position=&quot;AUTHENTICATION_PROCESSING_FILTER&quot; /&gt;
		&lt;property name=&quot;defaultTargetUrl&quot; value=&quot;/main.html&quot; /&gt;
		&lt;property name=&quot;authenticationManager&quot; ref=&quot;authenticationManager&quot; /&gt;
	&lt;/bean&gt;

	&lt;security:authentication-manager alias=&quot;authenticationManager&quot; /&gt;

	&lt;bean id=&quot;authenticationProcessingFilterEntryPoint&quot;
		class=&quot;org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint&quot;&gt;
		&lt;property name=&quot;loginFormUrl&quot; value=&quot;/index.jsp&quot; /&gt;
		&lt;property name=&quot;forceHttps&quot; value=&quot;false&quot; /&gt;
	&lt;/bean&gt;

    &lt;!--
    Usernames/Passwords are
        rod/koala
        dianne/emu
        scott/wombat
        peter/opal
    These passwords are from spring security app example
    --&gt;
    &lt;security:authentication-provider&gt;
        &lt;security:password-encoder hash=&quot;md5&quot;/&gt;
        &lt;security:user-service&gt;
            &lt;security:user name=&quot;rod&quot; password=&quot;a564de63c2d0da68cf47586ee05984d7&quot; authorities=&quot;ROLE_SUPERVISOR, ROLE_USER, ROLE_TELLER&quot; /&gt;
            &lt;security:user name=&quot;dianne&quot; password=&quot;65d15fe9156f9c4bbffd98085992a44e&quot; authorities=&quot;ROLE_USER,ROLE_TELLER&quot; /&gt;
            &lt;security:user name=&quot;scott&quot; password=&quot;2b58af6dddbd072ed27ffc86725d7d3a&quot; authorities=&quot;ROLE_USER&quot; /&gt;
            &lt;security:user name=&quot;peter&quot; password=&quot;22b5c9accc6e1ba628cedc63a72d57f8&quot; authorities=&quot;ROLE_USER&quot; /&gt;
	    &lt;/security:user-service&gt;
	&lt;/security:authentication-provider&gt;
&lt;/beans&gt;
</pre>
<p>Now you can login using ExtJS login form.</p>
<p>I coded a sample application for this example. If you like it, you can download it from my GitHub: <a href="http://github.com/loiane/spring-security-extjs-login" target="_blank">http://github.com/loiane/spring-security-extjs-login</a></p>
<p>Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=210&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qiKbU5DGWQc:w6qlJh9YhIY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qiKbU5DGWQc:w6qlJh9YhIY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qiKbU5DGWQc:w6qlJh9YhIY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=qiKbU5DGWQc:w6qlJh9YhIY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qiKbU5DGWQc:w6qlJh9YhIY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qiKbU5DGWQc:w6qlJh9YhIY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=qiKbU5DGWQc:w6qlJh9YhIY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=qiKbU5DGWQc:w6qlJh9YhIY:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/qiKbU5DGWQc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/02/integrating-spring-security-with-extjs-login-page/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/02/integrating-spring-security-with-extjs-login-page/</feedburner:origLink></item>
		<item>
		<title>Spring Security: Login and Logout Form JSP</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/CR-idM70TIA/</link>
		<comments>http://loianegroner.com/2010/01/spring-security-login-and-logout-form-jsp/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 10:00:52 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring Security]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[logout]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=143</guid>
		<description><![CDATA[When you configure spring security in your web application you can configure your login.jsp in the applicationContext-security.xml. But how this page looks like? If you search around, you are not going to find it easily. There is many articles about how to configure spring security, but a few ones list login.jsp. If you take a [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/01/spring_security_login.jpg"><img class="aligncenter size-full wp-image-206" title="spring_security_login" src="http://loianegroner.com/wp-content/uploads/2010/01/spring_security_login.jpg" alt="" width="360" height="289" /></a></p>
<p style="text-align: justify;">When you configure spring security in your web application you can configure your <strong><em>login.jsp</em></strong> in the <strong>applicationContext-security.xml</strong>.</p>
<p style="text-align: justify;">But how this page looks like? If you search around, you are not going to find it easily. There is many articles about how to configure spring security, but a few ones list login.jsp.</p>
<p style="text-align: justify;">If you take a look in the spring security distribution file, you are going to find an example application, and inside it: login.jsp and logout link.</p>
<h3>login.jsp</h3>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt' %&gt;
&lt;%@ page import=&quot;org.springframework.security.ui.AbstractProcessingFilter&quot; %&gt;
&lt;%@ page import=&quot;org.springframework.security.ui.webapp.AuthenticationProcessingFilter&quot; %&gt;
&lt;%@ page import=&quot;org.springframework.security.AuthenticationException&quot; %&gt;

&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Login&lt;/title&gt;
  &lt;/head&gt;

  &lt;body&gt;
    &lt;h1&gt;Login&lt;/h1&gt;

    &lt;c:if test=&quot;${not empty param.login_error}&quot;&gt;
      &lt;font color=&quot;red&quot;&gt;
        Your login attempt was not successful, try again.&lt;br/&gt;&lt;br/&gt;
        Reason: &lt;c:out value=&quot;${SPRING_SECURITY_LAST_EXCEPTION.message}&quot;/&gt;.
      &lt;/font&gt;
    &lt;/c:if&gt;

    &lt;form name=&quot;f&quot; action=&quot;&lt;c:url value='j_spring_security_check'/&gt;&quot; method=&quot;POST&quot;&gt;
      &lt;table&gt;
        &lt;tr&gt;&lt;td&gt;User:&lt;/td&gt;&lt;td&gt;&lt;input type='text' name='j_username' value='&lt;c:if test=&quot;${not empty param.login_error}&quot;&gt;&lt;c:out value=&quot;${SPRING_SECURITY_LAST_USERNAME}&quot;/&gt;&lt;/c:if&gt;'/&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;Password:&lt;/td&gt;&lt;td&gt;&lt;input type='password' name='j_password'&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;input type=&quot;checkbox&quot; name=&quot;_spring_security_remember_me&quot;&gt;&lt;/td&gt;&lt;td&gt;Don't ask for my password for two weeks&lt;/td&gt;&lt;/tr&gt;

        &lt;tr&gt;&lt;td colspan='2'&gt;&lt;input name=&quot;submit&quot; type=&quot;submit&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td colspan='2'&gt;&lt;input name=&quot;reset&quot; type=&quot;reset&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;/table&gt;
    &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p style="text-align: justify;">The names of the fields MUST remain the same or else your authentication will fail.</p>
<p style="text-align: justify;">As far as the logout goes, all you have to do is send the user to a particular servlet define by spring-security.</p>
<h3>logout link:</h3>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;a href=&quot;&lt;c:url value=&quot;/j_spring_security_logout&quot;/&gt;&quot;&gt;Logout&lt;/a&gt;
</pre>
<p>That&#8217;s it!</p>
<p>Happy Coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=143&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=CR-idM70TIA:tx0bP7U-glg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=CR-idM70TIA:tx0bP7U-glg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=CR-idM70TIA:tx0bP7U-glg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=CR-idM70TIA:tx0bP7U-glg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=CR-idM70TIA:tx0bP7U-glg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=CR-idM70TIA:tx0bP7U-glg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=CR-idM70TIA:tx0bP7U-glg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=CR-idM70TIA:tx0bP7U-glg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/CR-idM70TIA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/01/spring-security-login-and-logout-form-jsp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/01/spring-security-login-and-logout-form-jsp/</feedburner:origLink></item>
		<item>
		<title>Tutorial: Getting Started with Spring Security</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/yIJVBl3VnBU/</link>
		<comments>http://loianegroner.com/2010/01/tutorial-getting-started-with-spring-security/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 10:00:23 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring Security]]></category>
		<category><![CDATA[Acegi]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=164</guid>
		<description><![CDATA[This tutorial will cover a basic scenario where it  integrates Spring Security, using database-backed authentication, into an existing Spring web application. Spring Security is a security framework that provides declarative security for your Spring-based applications. Spring Security provides a comprehensive security solution, handling authentication and authorization, at both the web request level and at the [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2010/01/spring-security.jpg"><img class="aligncenter size-full wp-image-204" title="spring security" src="http://loianegroner.com/wp-content/uploads/2010/01/spring-security.jpg" alt="" width="360" height="232" /></a></p>
<p style="text-align: justify;">This tutorial will cover a basic scenario where it  integrates <a href="http://static.springsource.org/spring-security/site/index.html" target="_blank">Spring Security</a>, using database-backed authentication, into an existing Spring web application.</p>
<blockquote>
<p style="text-align: justify;">Spring Security is a security framework that provides declarative security for your Spring-based applications. Spring Security provides a comprehensive security solution, handling authentication and authorization, at both the web request level and at the method invocation level. Based on the Spring Framework, Spring Security takes full advantage of dependency injection (DI) and aspect oriented techniques.</p>
</blockquote>
<blockquote>
<p style="text-align: justify;">Spring Security is also known as Acegi Security (or simply Acegi).</p>
</blockquote>
<p style="text-align: justify;">As with anything else related to spring the learning curve on spring-security is just as steep. But once you get the hang of it, it’s easy peasy and you can use the same configuration over and over again in your web apps.</p>
<p style="text-align: justify;">When I started to study Spring Security, I found <a href="http://static.springsource.org/spring-security/site/start-here.html" target="_blank">these suggested steps</a> at Spring Security page.</p>
<p style="text-align: justify;">If you want to configure Spring Security in your web application, follow the steps:</p>
<p style="text-align: justify;">First thing you need to do is to add the jar files in the application classpath. <a href="http://static.springsource.org/spring-security/site/downloads.html" target="_blank">Download Spring Security</a>, and from inside dist folder, copy the following jar files and paste them into your web application lib folder:</p>
<ul>
<li>spring-security-core-2.0.4.jar</li>
<li>spring-security-core-tiger-2.0.4.jar</li>
<li>spring-security-acl-2.0.4.jar</li>
<li>spring-security-taglibs-2.0.4.jar</li>
</ul>
<p>Also, you need to download <a href="http://commons.apache.org/codec/download_codec.cgi" target="_blank">Apache Commons Codec</a>: <em>commons-codec-1.3.jar</em></p>
<p>Now, let’s start with XML configuration.</p>
<h3><strong><span style="color: #800000;">Web.xml</span></strong></h3>
<p>Insert the following block of code. It should be inserted right after the/context-param end-tag.</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;context-param&gt;
	&lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
	&lt;param-value&gt;
           /WEB-INF/security-applicationContext.xml
	&lt;/param-value&gt;
&lt;/context-param&gt;

&lt;filter&gt;
	&lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
	&lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
&lt;/filter&gt;

&lt;filter-mapping&gt;
	&lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt;
	&lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/filter-mapping&gt;
</pre>
<h3><span style="color: #800000;"><strong>applicationContext-security.xml</strong></span></h3>
<p style="text-align: justify;">Let’s create the applicationContext-security.xml.</p>
<p style="text-align: justify;">I would suggest getting started with the applicationContext-security.xml that is found in the tutorial sample, and trimming it down a bit. Here’s what I got when I trimmed it down:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;!--
  - Sample namespace-based configuration
  -
  - $Id: applicationContext-security.xml 3019 2008-05-01 17:51:48Z luke_t $
  --&gt;

&lt;beans:beans xmlns=&quot;http://www.springframework.org/schema/security&quot;
    xmlns:beans=&quot;http://www.springframework.org/schema/beans&quot;
    xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
    xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd

http://www.springframework.org/schema/security

http://www.springframework.org/schema/security/spring-security-2.0.1.xsd&quot;&gt;

	&lt;global-method-security secured-annotations=&quot;enabled&quot;&gt;
	&lt;/global-method-security&gt;

    &lt;http auto-config=&quot;true&quot;&gt;
        &lt;intercept-url pattern=&quot;/**&quot; access=&quot;IS_AUTHENTICATED_ANONYMOUSLY&quot; /&gt;
    &lt;/http&gt;

    &lt;!--
    Usernames/Passwords are
        rod/koala
        dianne/emu
        scott/wombat
        peter/opal
    --&gt;
    &lt;authentication-provider&gt;
        &lt;password-encoder hash=&quot;md5&quot;/&gt;
        &lt;user-service&gt;
            &lt;user name=&quot;rod&quot; password=&quot;a564de63c2d0da68cf47586ee05984d7&quot; authorities=&quot;ROLE_SUPERVISOR, ROLE_USER, ROLE_TELLER&quot; /&gt;
            &lt;user name=&quot;dianne&quot; password=&quot;65d15fe9156f9c4bbffd98085992a44e&quot; authorities=&quot;ROLE_USER,ROLE_TELLER&quot; /&gt;
            &lt;user name=&quot;scott&quot; password=&quot;2b58af6dddbd072ed27ffc86725d7d3a&quot; authorities=&quot;ROLE_USER&quot; /&gt;
            &lt;user name=&quot;peter&quot; password=&quot;22b5c9accc6e1ba628cedc63a72d57f8&quot; authorities=&quot;ROLE_USER&quot; /&gt;
	    &lt;/user-service&gt;
	&lt;/authentication-provider&gt;
&lt;/beans:beans&gt;
</pre>
<p>Now, you can try to execute the web application.</p>
<p>If you try to execute the app and get this <strong>exception</strong>:</p>
<pre class="brush: java; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext-security.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:448)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
</pre>
<p>Download <strong><em>aspectjrt-1.5.4.jar</em></strong> and add it to your application classpath. It will work.</p>
<p><strong>Let’s make some changes in applicationContext-security.xml.</strong></p>
<p>First change: replace the following code</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;http auto-config=&quot;true&quot;&gt;
        &lt;intercept-url pattern=&quot;/**&quot; access=&quot;IS_AUTHENTICATED_ANONYMOUSLY&quot; /&gt;
&lt;/http&gt;
</pre>
<p>for</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;http auto-config=&quot;true&quot;&gt;

    	&lt;!-- Don't set any role restrictions on login.jsp --&gt;
    	&lt;intercept-url pattern=&quot;/login.jsp&quot; access=&quot;IS_AUTHENTICATED_ANONYMOUSLY&quot; /&gt;

    	&lt;!-- Restrict access to ALL other pages --&gt;
        &lt;intercept-url pattern=&quot;/**&quot; access=&quot;ROLE_USER&quot; /&gt;

        &lt;!-- Set the login page and what to do if login fails --&gt;
        &lt;form-login login-page=&quot;/login.jsp&quot; authentication-failure-url=&quot;/login.jsp?login_error=1&quot; /&gt;

&lt;/http&gt;
</pre>
<p style="text-align: justify;">The <strong>auto-config</strong> attribute basically tells spring-security to configure default settings for itself.</p>
<p style="text-align: justify;">The <strong>login.jsp</strong> is allowed to be access from ANY role.</p>
<p style="text-align: justify;">Rrestricting access to it would mean that no one would be able to reach even the login page.</p>
<p style="text-align: justify;">Note how we are using a <em>jsp</em> instead of a <em>spring managed controller</em>. The login page does not need to be a spring managed controller at all.</p>
<p style="text-align: justify;">We also tell spring-security to <strong>restrict access</strong> to ALL url’s to only those users who have the role <strong>ROLE_USER</strong>.</p>
<p style="text-align: justify;">Let’s say you have more than one user role. <strong>Mapping URLs to roles</strong> is really easy. In your <em>http </em>element, simply put successive elements like this:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;intercept-url pattern=&quot;/admin/*.do&quot; access=&quot;ROLE_ADMIN&quot;  /&gt;
&lt;intercept-url pattern=&quot;/manager/*.do&quot; access=&quot;ROLE_MANAGER&quot;  /&gt;
&lt;intercept-url pattern=&quot;/**.do&quot; access=&quot;ROLE_USER,ROLE_ADMIN, ROLE_MANAGER&quot;  /&gt;
</pre>
<p style="text-align: justify;">Of course you do not want to put all the <strong>usernames </strong>and <strong>passwords </strong>and theirs <strong>roles </strong>in the <em>applicationContext-security.xml</em>. But how do we tell spring-security to get all user authentication details from the database?</p>
<p style="text-align: justify;">Put the following code in <em>applicationContext-security.xml</em> (replace usernames and passwords block of code)</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;!-- Configure the authentication provider --&gt;
&lt;security:authentication-provider&gt;
	&lt;security:jdbc-user-service data-source-ref=&quot;dataSource&quot; /&gt;
&lt;/security:authentication-provider&gt;
</pre>
<p style="text-align: justify;">This requires that a dataSource be created first.</p>
<p style="text-align: justify;">Now you ask: <em>what does the convention over configuration assume my database tables look like?</em></p>
<p style="text-align: justify;">You should be aware that the default authentication provider requires the database structure to be in a certain way:</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2010/01/spring-security-tutorial-database.png"><img class="aligncenter size-full wp-image-169" title="spring-security-tutorial-database" src="http://loianegroner.com/wp-content/uploads/2010/01/spring-security-tutorial-database.png" alt="" width="542" height="164" /></a></p>
<pre class="brush: sql; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
CREATE TABLE users
(
  username character varying(50) NOT NULL,
  &quot;password&quot; character varying(50) NOT NULL,
  enabled boolean NOT NULL,
  CONSTRAINT users_pkey PRIMARY KEY (username)
);

CREATE TABLE authorities
(
  username character varying(50) NOT NULL,
  authority character varying(50) NOT NULL,
  CONSTRAINT fk_authorities_users FOREIGN KEY (username)
      REFERENCES users (username) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
);

CREATE UNIQUE INDEX ix_auth_username
  ON authorities
  USING btree
  (username, authority);
</pre>
<p style="text-align: justify;">If you want to configure the queries that are used, simply match the available attributes on the jdbc-user-service element to the SQL queries in the Java class referenced above.</p>
<p style="text-align: justify;">For example: You want to simplify tha database schema by adding the user’s role directly to the user table. Let’s modify the xml configuration:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;jdbc-user-service data-source-ref=&quot;dataSource&quot;
    authorities-by-username-query=&quot;select username,authority from users where username=?&quot;/&gt;
</pre>
<p style="text-align: justify;">There are a couple other pages that maybe you want to configure.</p>
<p style="text-align: justify;"><strong>Access Denied</strong>: This is the page the user will see if they are denied access to the site due to lack of authorization (i.e. tried to hit a page that they didn’t have access to hit, even though they were authenticated properly). This is configured as follows:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;http ... access-denied-page=&quot;/accessDenied.jsp&quot;&gt;
     ...
&lt;/http&gt;
</pre>
<p style="text-align: justify;"><strong>Default Target URL:</strong> This is where the user will be redirected upon successful login. This can (and probably should) be a page located under Spring control. Configured as follows:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;http ... &gt;
    ...
        &lt;form-login ... default-target-url=&quot;/home.do&quot;/&gt;
    ...
&lt;/http&gt;
</pre>
<p style="text-align: justify;"><strong>Logout URL</strong>: The page where the user is redirected upon a successful logout. This can be a page located under Spring control too (provided that it allows anonymous access):</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;http ... &gt;
    ...
    	&lt;logout logout-success-url=&quot;/home.do&quot;/&gt;
    ...
&lt;/http&gt;
</pre>
<p style="text-align: justify;"><strong>Login Failure URL</strong>: Where the user will be sent if there was an authentication failure. Typically this is back to the login form, with a URL parameter, such as:</p>
<pre class="brush: xml; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
&lt;http ... &gt;
    ...
        &lt;form-login ... authentication-failure-url=&quot;/login.jsp?login_error=1&quot;/&gt;
    ...
&lt;/http&gt;
</pre>
<p>This is what you need to get started with Spring Security.</p>
<p>Next week, I am going to post how Spring Security <strong>login.jsp</strong> looks like.</p>
<p>Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=164&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=yIJVBl3VnBU:WSwNnSY_qws:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=yIJVBl3VnBU:WSwNnSY_qws:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=yIJVBl3VnBU:WSwNnSY_qws:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=yIJVBl3VnBU:WSwNnSY_qws:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=yIJVBl3VnBU:WSwNnSY_qws:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=yIJVBl3VnBU:WSwNnSY_qws:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=yIJVBl3VnBU:WSwNnSY_qws:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=yIJVBl3VnBU:WSwNnSY_qws:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/yIJVBl3VnBU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/01/tutorial-getting-started-with-spring-security/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/01/tutorial-getting-started-with-spring-security/</feedburner:origLink></item>
		<item>
		<title>My DeveloperWorks: What’s life like for a female Java Developer in Brazil?</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/ZgzL1S1NAQc/</link>
		<comments>http://loianegroner.com/2010/01/my-developerworks-whats-life-like-for-a-female%c2%a0java-developer-in-brazil/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 12:55:57 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[developerWorks]]></category>
		<category><![CDATA[My developerWorks]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=189</guid>
		<description><![CDATA[Just wanted to share with you my interview on Valerie&#8217;s My developerWorks blog: Interview with Loiane Groner, Java developer in Brazil. I&#8217;m very happy, because this interview was the most viewed entry on My developerWorks yesterday: And if you look at the corner, you will see my blog in &#8220;Featured Blogs&#8220;! It is just a [...]]]></description>
			<content:encoded><![CDATA[
<p>Just wanted to share with you my interview on Valerie&#8217;s My developerWorks blog: <a href="https://www.ibm.com/developerworks/mydeveloperworks/blogs/yinmeetsyang/entry/interview_with_loiane_groner_java_developer_in_brazil7?lang=en_us&amp;ca=dth-mydw" target="_blank">Interview with Loiane Groner, Java developer in Brazil</a>.</p>
<p>I&#8217;m very happy, because this interview was the <strong>most viewed entry</strong> on My developerWorks yesterday:</p>
<div id="attachment_1404" class="wp-caption aligncenter" style="width: 603px"><a href="http://loianegroner.com/wp-content/uploads/2010/01/developerworks_loiane.png" target="_blank"><img class="size-full wp-image-1404" title="developerworks_loiane" src="http://loianegroner.com/wp-content/uploads/2010/01/developerworks_loiane.png" alt="click on the picture to see full size" width="593" height="407" /></a><p class="wp-caption-text">click on the picture to see full size</p></div>
<p>And if you look at the corner, you will see my blog in &#8220;<strong>Featured Blogs</strong>&#8220;! <img src='http://loianegroner.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>It is just a copy from this one. The tutorials are the same.</p>
<p>There is also some twitter statuses:</p>
<p>From Valerie&#8217;s:</p>
<blockquote>
<div id="_mcePaste"><strong>Cool new interview on my blog w/ Loiane Groner, java developer making her mark in Brazil: <a href="http://bit.ly/8FbnzL" target="_blank">http://bit.ly/8FbnzL</a></strong> (<a href="http://twitter.com/vmichelle/status/7634056149" target="_blank">http://twitter.com/vmichelle/status/7634056149</a> )</div>
</blockquote>
<p>From developerWorks&#8217;:</p>
<blockquote><p><strong>What&#8217;s life like for a female #javadeveloper in Brazil? Interview w/ Loiane Groner <a href="http://bit.ly/8FbnzL" target="_blank">http://bit.ly/8FbnzL</a></strong> (<a href="http://twitter.com/developerworks/status/7634404961" target="_blank">http://twitter.com/developerworks/status/7634404961</a> )</p></blockquote>
<p style="text-align: left;">Thank you Valerie, for giving me this opportunity!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=189&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ZgzL1S1NAQc:9q_IKQYekMg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ZgzL1S1NAQc:9q_IKQYekMg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ZgzL1S1NAQc:9q_IKQYekMg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=ZgzL1S1NAQc:9q_IKQYekMg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ZgzL1S1NAQc:9q_IKQYekMg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ZgzL1S1NAQc:9q_IKQYekMg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=ZgzL1S1NAQc:9q_IKQYekMg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=ZgzL1S1NAQc:9q_IKQYekMg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/ZgzL1S1NAQc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/01/my-developerworks-whats-life-like-for-a-female%c2%a0java-developer-in-brazil/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/01/my-developerworks-whats-life-like-for-a-female%c2%a0java-developer-in-brazil/</feedburner:origLink></item>
		<item>
		<title>How to Display an Image/Link Inside an Ext JS GridPanel’s Cell</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/luOWuynszHc/</link>
		<comments>http://loianegroner.com/2010/01/how-to-display-an-imagelink-inside-an-ext-js-gridpanels-cell/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 10:00:11 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[ExtJS Grid]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=114</guid>
		<description><![CDATA[This tutorial will walk through how you can display an image/link inside an Ext GridPanel cell using a renderer function. To explain this approach, I will use a sample GridPanel that displays some dummy contact information (name, phone, birthday and email). Together with email data, we will display a link (mailto) and an email link icon/image. How to [...]]]></description>
			<content:encoded><![CDATA[
<p>This tutorial will walk through how you can display an image/link inside an Ext <strong>GridPanel</strong> cell using a renderer function.</p>
<p><a href="http://loianegroner.com/wp-content/uploads/2009/12/extjs-grid-cell-with-image-and-link.png"><img class="aligncenter size-full wp-image-138" title="extjs-grid-cell-with-image-and-link" src="http://loianegroner.com/wp-content/uploads/2009/12/extjs-grid-cell-with-image-and-link.png" alt="" width="602" height="278" /></a></p>
<p>To explain this approach, I will use a sample <strong>GridPanel</strong> that displays some dummy contact information (name, phone, birthday and email). Together with email data, we will display a link (mailto) and an email link icon/image.</p>
<h3><span style="color: #800000;">How to do it</span></h3>
<p>First, we need some data to work with.  An <strong>ArrayStore</strong> with a few dummy records:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
//array with data - dummy data
var myData = [
    ['Meyers, Quyn R.',	    '(943) 570-5141', 'Proin@nullamagna.ca',    '05/13/1990'],
	['Whitney, Tad T.',	    '(547) 743-0343', 'vulputate@acurnaUt.org', '05/10/1987'],
	['Lawrence, Flavia J.',	'(404) 826-4553', 'dapibus.id@accumsan.ca',	'01/05/1988'],
	['Morales, Susan I.',	'(276) 707-8084', 'tristique@seacmetus.com','03/09/1992'],
	['Merrill, Desiree Q.', '(911) 546-0559', 'dictum.cursus@vel.ca',   '01/07/1981'],
	['Hampton, Willa Y.',	'(729) 562-8303', 'nascetur@stellus.ca',    '06/17/1991'],
	['Brewer, Brynne F.',	'(818) 302-4393', 'ligula@ullamcorper.org',	'04/20/1989'],
	['Marsh, Drew D.',	    '(645) 671-2779', 'et.euismod.et@eget.ca',	'02/13/1990']
];
</pre>
<p>GirdPanel definition:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
// create grid
var grid = new Ext.grid.GridPanel({
    store: store,
    columns: [
        {header: 'NAME', width: 170, sortable: true, dataIndex: 'name'},
        {header: 'PHONE #', width: 150, sortable: true, dataIndex: 'phone'},
        {header: 'BIRTHDAY', width: 100, sortable: true, dataIndex: 'birthday',
        	renderer: Ext.util.Format.dateRenderer('d/m/Y')},
        {header: 'EMAIL', width: 160, sortable: true, dataIndex: 'email',
        	renderer: renderIcon }
    ],
    title: 'My Contacts',
    autoHeight:true,
    width:600,
	renderTo: document.body,
	frame:true
});
</pre>
<h3><span style="color: #800000;">How it works</span></h3>
<pre class="brush: jscript; collapse: false; wrap-lines: false;">
{header: 'EMAIL', width: 160, sortable: true, dataIndex: 'email', renderer: renderIcon }
</pre>
<p>The insteresting part in the above code is the trend column&#8217;s <strong>mail</strong>.  A renderer function is an interceptor method that can change the grid cell before it is rendered.</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
//image path
var IMG_EMAIL = '/gridcell-with-image/img/email_link.png';

//renderer function
function renderIcon(val) {
    return '&lt;a href=&quot;mailto:' + val + '&quot;&gt;'+ '&lt;img src=&quot;' + IMG_EMAIL + '&quot;&gt; ' + val  +'&lt;/a&gt;';
}
</pre>
<p>Inside the renderer function we just put some HTML code to display what we want. Pretty easy!</p>
<p>Now you can create your own renderer functions!</p>
<p>Happy coding!</p>
<p>Download (J2EE project): <a href="http://github.com/loiane/gridcell-with-image" target="_blank"><img title="public" src="http://www.loiane.com/wp-content/uploads/2009/11/public.png" alt="public" width="16" height="16" /> http://github.com/loiane/gridcell-with-image</a></p>
<p>Portuguese: <a href="http://www.loiane.com/2010/01/extjs-como-colocar-icone-e-link-nas-celulas-do-grid/" target="_blank">http://www.loiane.com/2010/01/extjs-como-colocar-icone-e-link-nas-celulas-do-grid/</a></p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=114&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=luOWuynszHc:Xdr7ja5CsFQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=luOWuynszHc:Xdr7ja5CsFQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=luOWuynszHc:Xdr7ja5CsFQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=luOWuynszHc:Xdr7ja5CsFQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=luOWuynszHc:Xdr7ja5CsFQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=luOWuynszHc:Xdr7ja5CsFQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=luOWuynszHc:Xdr7ja5CsFQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=luOWuynszHc:Xdr7ja5CsFQ:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/luOWuynszHc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/01/how-to-display-an-imagelink-inside-an-ext-js-gridpanels-cell/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/01/how-to-display-an-imagelink-inside-an-ext-js-gridpanels-cell/</feedburner:origLink></item>
		<item>
		<title>Ext.Window Panel: Show or Hide?</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/Tw_9YoRPqes/</link>
		<comments>http://loianegroner.com/2010/01/ext-window-panel-show-or-hide/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 10:00:16 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Window]]></category>
		<category><![CDATA[Ext.Window]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=117</guid>
		<description><![CDATA[From this short tutorial you will learn how to control the Ext.Window panel. It explains how to hide or show it on button click. Problem: you created a Ext.Window, clicked on a button or link (or something else) and a window showed up. You clicked on close button (up right corner) and it closed. You [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;">From this short tutorial you will learn how to control the Ext.Window panel. It explains how to hide or show it on button click.</p>
<p style="text-align: justify;"><a href="http://loianegroner.com/wp-content/uploads/2009/12/ext.window_hide_or_close.png"><img class="aligncenter size-full wp-image-119" title="ext.window_hide_or_close" src="http://loianegroner.com/wp-content/uploads/2009/12/ext.window_hide_or_close.png" alt="" width="511" height="312" /></a></p>
<p style="text-align: justify;"><strong>Problem</strong>: you created a Ext.Window, clicked on a button or link (or something else) and a window showed up. You clicked on close button (up right corner) and it closed. You tried again, but the window did not show from second time (and on) &#8211; maybe you got an error message in Firebug console.</p>
<p style="text-align: justify;"><strong>Solution</strong>: the default behaviour of this componet is to close. But close means destroy the component, so the second time you tried to open it, it did not work. The solution is to hide the window, so you can reuse it when you need it again.</p>
<p style="text-align: justify;">Let&#8217;s see some code (Reference: <a href="http://www.extjs.com/deploy/dev/examples/window/hello.html" target="_blank">Hello Word Window</a>)</p>
<p style="text-align: justify;"><strong>HTML</strong>:</p>
<pre class="brush: xml; collapse: false; toolbar: true; wrap-lines: false;">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Ext.Window: close or hide&lt;/title&gt;

	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/ext-window/ext-3.0.3/resources/css/ext-all.css&quot; /&gt;

	&lt;script src=&quot;/ext-window/ext-3.0.3/adapter/ext/ext-base.js&quot;&gt;&lt;/script&gt;
	&lt;script src=&quot;/ext-window/ext-3.0.3/ext-all.js&quot;&gt;&lt;/script&gt;

	&lt;script src=&quot;/ext-window/js/ext-window.js&quot;&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
	&lt;input type=&quot;button&quot; id=&quot;show-btn&quot; value=&quot;Show Window&quot; /&gt;

	&lt;div id=&quot;hello-win&quot; class=&quot;x-hidden&quot;&gt;

    &lt;div class=&quot;x-window-header&quot;&gt;Hello Dialog&lt;/div&gt;
    &lt;div id=&quot;hello-tabs&quot;&gt;
        &lt;!-- Auto create tab 1 --&gt;
        &lt;div class=&quot;x-tab&quot; title=&quot;Hello World&quot;&gt;
            &lt;p&gt;Ext.Window Panel: Close or Hide?&lt;/p&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>JS</strong>:</p>
<pre class="brush: jscript; collapse: false; first-line: 1; toolbar: true; wrap-lines: false;">
Ext.onReady(function(){

	Ext.BLANK_IMAGE_URL = '/ext-window/ext-3.0.3/resources/images/default/s.gif';

    var win;
    var button = Ext.get('show-btn');

    var tab = new Ext.TabPanel({
        applyTo: 'hello-tabs',
        autoTabs:true,
        activeTab:0,
        deferredRender:false,
        border:false
    });

    button.on('click', function(){

        // create the window on the first click and reuse on subsequent clicks
    	//cria a janela no primeiro clique e a reusa nos próximos cliques
        if(!win){
            win = new Ext.Window({
                applyTo:'hello-win',
                layout:'fit',
                width:500,
                height:300,
                closeAction:'hide', //'close' - destroy the component
                plain: true,

                items: tab,

                buttons: [{
                    text: 'Close',
                    handler: function(){
                        win.hide();
                    }
                }]
            });
        }
        win.show(this);
    });
});
</pre>
<p>Happy Coding!</p>
<p>Download (J2EE project): <a href="http://github.com/loiane/ext-window" target="_blank"><img title="public" src="http://www.loiane.com/wp-content/uploads/2009/11/public.png" alt="public" width="16" height="16" /> http://github.com/loiane/ext-window</a></p>
<p>Portuguese: ExtJS: <a href="http://www.loiane.com/2010/01/extjs-ext-window-hide-ou-close/" target="_blank">Ext.Window: hide ou close?</a></p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=117&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Tw_9YoRPqes:eM6AhK2t_xo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Tw_9YoRPqes:eM6AhK2t_xo:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Tw_9YoRPqes:eM6AhK2t_xo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=Tw_9YoRPqes:eM6AhK2t_xo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Tw_9YoRPqes:eM6AhK2t_xo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Tw_9YoRPqes:eM6AhK2t_xo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=Tw_9YoRPqes:eM6AhK2t_xo:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Tw_9YoRPqes:eM6AhK2t_xo:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/Tw_9YoRPqes" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2010/01/ext-window-panel-show-or-hide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2010/01/ext-window-panel-show-or-hide/</feedburner:origLink></item>
		<item>
		<title>Getting Started with ExtJS DataGrid</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/7g-DzEDO00U/</link>
		<comments>http://loianegroner.com/2009/12/getting-started-with-extjs-datagrid/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 14:12:55 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[ExtJS Grid]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=93</guid>
		<description><![CDATA[This tutorial will walk through how to implement a simple Ext JS datagrid, using a GridPanel to display structured data in a user-friendly grid. Screeshot for this tutorial: The grid is, without doubt, one of the most widely-used components of Ext. We all have data, and this needs to be presented to the end user [...]]]></description>
			<content:encoded><![CDATA[
<p>This tutorial will walk through how to implement a simple Ext JS datagrid,  using a GridPanel to display structured data in a user-friendly grid.</p>
<p>Screeshot for this tutorial:</p>
<p><img class="aligncenter size-full wp-image-99" title="extjs_simple_grid_loiane" src="http://loianegroner.com/wp-content/uploads/2009/12/extjs_simple_grid_loiane.PNG" alt="extjs_simple_grid_loiane" width="591" height="235" /></p>
<p>The grid is, without doubt, one of the most widely-used components of Ext. We all have data, and this needs to be presented to the end user in an easy-to-understand manner. The spreadsheet (a.k.a.: grid) is the perfect way to do this—the concept has been around for quite a while because it works. Ext takes that concept and makes it flexible and downright amazing!</p>
<h3><span style="color: #800000;">Terminology:</span></h3>
<p>Displaying data in a grid requires two Ext components:</p>
<ul>
<li>A store that acts like an in-memory database, keeping track of the data we want to display</li>
<li>A grid panel that provides a way to display the data stored in a data store</li>
</ul>
<p>Before we start to create each of these, let&#8217;s look at some of the terminology that will be used, because this can be confusing at first:</p>
<ul>
<li>Columns: This refers to a whole column of data, and would contain information only relevant to the display of data down through the entire column, including the heading. In Ext JS, this information is part of the Column Model.</li>
<li>Fields: This also refers to an entire column of data, but is refers to the actual data values. With Ext JS, this is used in the reader, for loading data.</li>
</ul>
<p>Before we get started, you must configure your project to use Ext JS library. If you do not know how to do it, you can check it out <a href="http://loianegroner.com/2009/12/getting-started-with-extjs-in-your-j2ee-project/" target="_blank">this tutorial</a>.</p>
<h3><span style="color: #800000;">Setting up a data store:</span></h3>
<p>The first thing we need to do is set up our data, which will be placed into a data store. The data store types available in Ext give us a consistent way of reading different data formats such as XML and JSON, and reading this data in a consistent way throughout all of the Ext widgets. Regardless of whether this data it is JSON, XML, an array, or even a custom data type of your own, it&#8217;s all accessed in the same way thanks to the data store.</p>
<p>Some data stores available, by default, in Ext are:</p>
<ul>
<li> Simple (Array)</li>
<li> XML</li>
<li> JSON</li>
</ul>
<h3><span style="color: #800000;">Step 1: Adding data to our data store:</span></h3>
<p>In this first example, we are going to use a simple (array) data store, represeting a simple agenda (name, phone, email and birthday date).</p>
<p>The data store needs two things: the data itself, and a description of the data—or what could be thought of as the fields. A reader will be used to read the data from the array, and this is where we define the fields of data contained in our array. The reader acts as an interpreter of sorts; it knows how to interpret a string of data as rows of data to be used with Ext JS.</p>
<h3><span style="color: #800000;">Step 2:</span> <span style="color: #800000;">Defining your data for the data store</span></h3>
<p>The reader needs to know which fields to read in as data for our data store, so we will need to define these.</p>
<p>Fields are defined using an array of objects—or if the data is to be read verbatim, just a string specifying the field name. All except one of our fields in this example can be defined with a simple name. For example, the title field could be defined using an object like this:</p>
<p>{name: &#8216;title&#8217;}</p>
<p>However, in our case, because we are just reading in the data as a string, we can simply pass the field name and save some typing:</p>
<p>&#8216;title&#8217;</p>
<p>The released field is different because we want to treat its data appropriately, as a date type. For each field format type, there may be options to define the format of the data more explicitly. With the date type, there is a dateFormat string that needs to be defined. If you have used PHP, these date format strings will look familiar, because Ext uses the same date format strings that PHP does.</p>
<p>{name: &#8216;released&#8217;, type: &#8216;date&#8217;, dateFormat: &#8216;Y-m-d&#8217;}</p>
<p>Here are some datatypes supported by ExtJS: string, int, float, boolean, date.</p>
<h3><span style="color: #800000;">Step 3: Displaying the GrigPanel</span></h3>
<p>The thing that pulls everything together is the GridPanel, which takes care of placing the data into columns and rows, along with adding column headers, and boxing everything together in a neat little package.</p>
<h3><span style="color: #800000;">Code:</span></h3>
<pre class="brush: jscript; collapse: false; toolbar: true; wrap-lines: false;">
Ext.onReady(function(){

	Ext.BLANK_IMAGE_URL = '/extjs-grid-simple-array/ext-3.0.3/resources/images/default/s.gif';

	//array with data
    var myData = [
        ['Meyers, Quyn R.',	    '(943) 570-5141', 'Proin@nullamagna.ca',    '05/13/1990'],
		['Whitney, Tad T.',	    '(547) 743-0343', 'vulputate@acurnaUt.org', '05/10/1987'],
		['Lawrence, Flavia J.',	'(404) 826-4553', 'dapibus.id@accumsan.ca',	'01/05/1988'],
		['Morales, Susan I.',	'(276) 707-8084', 'tristique@seacmetus.com','03/09/1992'],
		['Merrill, Desiree Q.', '(911) 546-0559', 'dictum.cursus@vel.ca',   '01/07/1981'],
		['Hampton, Willa Y.',	'(729) 562-8303', 'nascetur@stellus.ca',    '06/17/1991'],
		['Brewer, Brynne F.',	'(818) 302-4393', 'ligula@ullamcorper.org',	'04/20/1989'],
		['Marsh, Drew D.',	    '(645) 671-2779', 'et.euismod.et@eget.ca',	'02/13/1990']
    ];

    //data store - description of fields
    var store = new Ext.data.SimpleStore({
        fields: [
           'name',
           'phone',
           'email',
           {name: 'birthday', type: 'date', dateFormat: 'd/m/Y'}
        ]
    });

    //read the data from simple array
    store.loadData(myData);

    // create grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        columns: [
            {header: &amp;quot;NAME&amp;quot;, width: 170, sortable: true, dataIndex: 'name'},
            {header: &amp;quot;PHONE #&amp;quot;, width: 150, sortable: true, dataIndex: 'phone'},
            {header: &amp;quot;EMAIL&amp;quot;, width: 150, sortable: true, dataIndex: 'email'},
            {header: &amp;quot;BIRTHDAY&amp;quot;, width: 100, sortable: true, dataIndex: 'birthday',
            	renderer: Ext.util.Format.dateRenderer('d/m/Y')}
        ],
        title: 'My Contacts',
        autoHeight:true,
        width:590,
		renderTo: document.body,
		frame:true
    });

    //render to DIV
    grid.render('grid-simple-array');
});
</pre>
<p>You can download the source code in my Github: <a href="http://github.com/loiane/extjs-grid-simple-array" target="_blank"><img class="alignnone size-full wp-image-1238" title="public" src="http://www.loiane.com/wp-content/uploads/2009/11/public.png" alt="public" width="16" height="16" /> http://github.com/loiane/extjs-grid-simple-array</a></p>
<p>Reference: <a href="http://www.packtpub.com/learning-ext-js/book" target="_blank">Learning Ext JS &#8211; Book</a></p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=93&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7g-DzEDO00U:G_ZocTyshp8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7g-DzEDO00U:G_ZocTyshp8:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7g-DzEDO00U:G_ZocTyshp8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=7g-DzEDO00U:G_ZocTyshp8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7g-DzEDO00U:G_ZocTyshp8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7g-DzEDO00U:G_ZocTyshp8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=7g-DzEDO00U:G_ZocTyshp8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=7g-DzEDO00U:G_ZocTyshp8:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/7g-DzEDO00U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2009/12/getting-started-with-extjs-datagrid/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2009/12/getting-started-with-extjs-datagrid/</feedburner:origLink></item>
		<item>
		<title>Sun Tech Days Brazil Presentations</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/fgZcTmFqFRo/</link>
		<comments>http://loianegroner.com/2009/12/sun-tech-days-brazil-presentations/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 16:14:46 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[SUN]]></category>
		<category><![CDATA[Sun Tech Days]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=102</guid>
		<description><![CDATA[If you missed Sun Tech Days Brazil 2009 (December 8-9 &#8211; Sao Paulo), because of the rain (just like me: pt-br) or because any other reason, don&#8217;t worry about it! Sun published the presentations (pdf format). It is still missing two presentations: Keynotes Sun Microsystems Country Manager Introduction Sun Keynote: Be Agile: GlassFish, Java and [...]]]></description>
			<content:encoded><![CDATA[
<p>If you missed Sun Tech Days Brazil 2009 (December 8-9 &#8211; Sao Paulo), because of the rain (<a href="http://www.loiane.com/2009/12/minha-aventura-sun-tech-days-2009/" target="_blank">just like me</a>: pt-br) or because any other reason, don&#8217;t worry about it!</p>
<p>Sun <a href="http://developers.sun.com/events/techdays/presentations/2009/saopaulo.jsp" target="_blank">published the presentations</a> (pdf format). It is still missing two presentations:</p>
<ul class="icons">
<h3><span style="color: #800000;">Keynotes</span></h3>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_CountryManager_Maluf.pdf">Sun Microsystems Country Manager Introduction</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Day2Keynote_Padir.pdf">Sun Keynote: Be Agile: GlassFish, Java and MySQL &#8211; Karen Tegan Padir</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_OracleKeynote_Humphrey.pdf">Oracle Keynote: Java, The Platform for the Future &#8211; Pieter Humphrey</a></li>
</ul>
<ul class="icons">
<h3><span style="color: #800000;">Enterprise Computing</span></h3>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_JPA_Waite.pdf">Advanced JPA: Concurrency, Cashing and Performance</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Comet_Waite.pdf">Comet Everywhere: Building Truly Asynchronous Collaborative Web Applications</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_OSGF_Karlsson.pdf">Deploying the GlassFish Application Server on OpenSolaris: Monitoring, Provisioning and Backups</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_REST_Waite.pdf">Designing and Implementing Secure RESTful Web Services</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_GlassFish_Shin.pdf">GlassFish v3: The Next Generation Application Server</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Intel_Saraiva.pdf">Intel Technical Session: Solaris &amp; Java nos processadores Intel</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_JavaEE6Part1and2_Shin.pdf">JavaEE 6 Part 1: Themes, Managed Bean, Servlet 3.0, JPA 2.0</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_JavaEE6Part1and2_Shin.pdf">JavaEE 6 Part 2: EJB 3.1, JSF 2.0, Bean Validation 1.0, JAX-RS 1.1</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_MySQL_Karlsson.pdf">MySQL: The World&#8217;s Most Popular Open Source Database</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_OpenESB_Shin.pdf">OpenESB: Connecting the Enterprise</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_OracleTS_Trent.pdf">Oracle Technical Session: Oracle WebLogic Server Architecture, OSGi, and Java Enterprise Edition</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_OpenSSO_Shin.pdf">Simplify Your Single-Sign-On With OpenSSO</a></li>
</ul>
<ul class="icons">
<h3><span style="color: #800000;">Client Technologies</span></h3>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_AdvJavaFX_Ritter.pdf">Advanced JavaFX: Tips and Techniques</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_DtraceBtrace_Ritter.pdf">Debugging Java Applications with DTrace and BTrace</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Localhost_Leonard.pdf">Developing Beyond Localhost</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Ginga_Oliveria_Shabat.pdf">Ginga, LUWIT, JavaDTV and You</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_JavaTroubleshooting_Waite.pdf">Java Troubleshooting Tips</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_JavaFXMobile_Caicedo.pdf">JavaFX Programming for Mobile Devices</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_JavaFXQuick_Caicedo.pdf">JavaFX: Quick and Easy Rich Internet Applications</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_LWUIT_Caicedo.pdf">JavaME: Building Cool Interfaces with the Lightweight UI Toolkit</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_JDK7_Ritter.pdf">JDK7: The Future of The Java Platform</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Locaweb_Kung.pdf">Locaweb Technical Session: Cloud Computing. E eu com isso?</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_PerfTuning_Ritter.pdf">Performance Tuning Garbage Collection</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Scripting_Ritter.pdf">Scripting Languages: Options for the JVM</a></li>
</ul>
<ul class="icons">
<h3><span style="color: #800000;">OpenSolaris</span></h3>
<li class="pdficon">Application Consolidation with OpenSolaris Containers (coming soon)</li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_PowerUser_Solter.pdf">Becoming an OpenSolaris Power User</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_SunStudio_Kretsch.pdf">Building High Quality C/C++ Applications</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_HA_Solter.pdf">High Availability with OpenSolaris</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Multicore_Kretch.pdf">Mastering Your Multicore System</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_MaxAppPerf_Solter.pdf">Maximizing Application Performance</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_MovingtoOS_Leonard.pdf">Moving to OpenSolaris</a></li>
<li class="pdficon">Open Networking (coming soon)</li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_SourceJuicer_Vanoni.pdf">Porting Applications with the OpenSolaris SourceJuicer</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_OSSecurity_Karlsson.pdf">Securing Networked Services with OpenSolaris Security Features</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_Virt_Pronk.pdf">Virtualizing Your Application: Which Option is Right for You</a></li>
<li class="pdficon"><a href="http://developers.sun.com/events/techdays/presentations/2009/pdfs/TD_SP_OSNewAndCool_Armes.pdf">What&#8217;s New and Cool</a></li>
</ul>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=102&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=fgZcTmFqFRo:sZ7PFlpBk_0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=fgZcTmFqFRo:sZ7PFlpBk_0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=fgZcTmFqFRo:sZ7PFlpBk_0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=fgZcTmFqFRo:sZ7PFlpBk_0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=fgZcTmFqFRo:sZ7PFlpBk_0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=fgZcTmFqFRo:sZ7PFlpBk_0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=fgZcTmFqFRo:sZ7PFlpBk_0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=fgZcTmFqFRo:sZ7PFlpBk_0:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/fgZcTmFqFRo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2009/12/sun-tech-days-brazil-presentations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2009/12/sun-tech-days-brazil-presentations/</feedburner:origLink></item>
		<item>
		<title>Getting Started with JSON</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/Nq3FzF6PDRU/</link>
		<comments>http://loianegroner.com/2009/12/getting-started-with-json/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 10:00:45 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[JSON]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=66</guid>
		<description><![CDATA[This post will walk through JSON basic concepts. What is JSON? JSON (JavaScript Object Notation) is a lightweight data-interchange format, widely hailed as the successor to XML in the browser. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of [...]]]></description>
			<content:encoded><![CDATA[
<p>This post will walk through JSON basic concepts.</p>
<p><img class="aligncenter size-full wp-image-90" title="json_loiane" src="http://loianegroner.com/wp-content/uploads/2009/12/json_loiane.jpg" alt="json_loiane" width="290" height="225" /></p>
<h3><span style="color: #800000;"><strong>What is JSON?</strong></span></h3>
<p><a href="http://www.json.org/" target="_blank"><strong>JSON</strong> (JavaScript Object Notation) </a>is a lightweight data-interchange   format, widely hailed as the successor to XML in the browser.</p>
<p>It is easy for humans to read and write.</p>
<p>It is easy for machines to parse and generate.</p>
<p>It is based on a subset of the JavaScript Programming Language.</p>
<p>It is lighter than XML.</p>
<h3><span style="color: #800000;"><strong>JSON versus XML</strong></span></h3>
<p><span style="color: #800000;"><span style="color: #000000;">Ps.: This is </span></span>only from the javascript eval() point of view<span style="color: #800000;"><strong><span style="color: #000000;">.</span><br />
</strong></span></p>
<table border="1">
<tbody>
<tr>
<td style="font-weight: bold; text-align: center;">JSON</td>
<td style="font-weight: bold; text-align: center;">XML</td>
</tr>
<tr>
<td>JSON object are type</td>
<td>XML data is typeless</td>
</tr>
<tr>
<td>JSON types: string, number, array, boolean</td>
<td>XML data are all string</td>
</tr>
<tr>
<td>Data is readily accessible as JSON objects</td>
<td>XML data needs to be parsed</td>
</tr>
<tr>
<td>Retrieving value is easy</td>
<td>Retrieving value is difficult</td>
</tr>
<tr>
<td>JSON is supported by all browsers</td>
<td>Cross browser XML parsing can be tricky</td>
</tr>
<tr>
<td>Simple API</td>
<td>Complex API</td>
</tr>
<tr>
<td>Supported by many Ajax toolkit</td>
<td>Not fully supported by Ajax toolkit</td>
</tr>
<tr>
<td>Fast object de-serialization in JavaScript</td>
<td>Slower de-serialization in Javascript</td>
</tr>
<tr>
<td>Fully automated way of de-serializing/serializing JavaScript objects</td>
<td>Developers have to write javascript code to serialize/se-serialize to/from XML</td>
</tr>
</tbody>
</table>
<h3><span style="color: #800000;">JSON Values</span></h3>
<p>JSON is built on two structures:</p>
<ul>
<li>A collection of name/value pairs. In various languages, this is realized     as an <em>object</em>, record, struct, dictionary, hash table, keyed list, or     associative array.</li>
<li>An ordered list of values. In most languages, this is realized as an <em>array</em>,     vector, list, or sequence.</li>
</ul>
<p>An <em>object</em> is an unordered set of name/value pairs. An object   begins with <tt>{</tt> <small>(left brace)</small> and ends   with <tt>}</tt> <small>(right brace)</small>. Each name is followed   by <tt>:</tt> <small>(colon)</small> and the name/value pairs are   separated by <tt>,</tt> <small>(comma)</small>.</p>
<p style="text-align: justify;"><a href="http://www.json.org/object.gif"><img class="aligncenter" title="JSON Object" src="http://www.json.org/object.gif" alt="" width="598" height="113" /></a>An <em>array</em> is an ordered collection of values. An array begins   with <tt>[</tt> <small>(left bracket)</small> and ends   with <tt>]</tt> <small>(right bracket)</small>. Values are separated   by <tt>,</tt> <small>(comma)</small>.</p>
<p style="text-align: justify;"><a href="http://www.json.org/array.gif"><img class="aligncenter" title="JSON Array" src="http://www.json.org/array.gif" alt="" width="598" height="113" /></a>A <em>value</em> can be a <em>string</em> in double quotes, or a <em>number</em>,   or <tt>true</tt> or <tt>false</tt> or <tt>null</tt>, or an <em>object</em> or   an <em>array</em>. These structures can be nested.</p>
<p style="text-align: justify;"><img class="aligncenter" title="Json value" src="http://www.json.org/value.gif" alt="" width="598" height="278" /></p>
<p style="text-align: justify;">A <em>string</em> is a collection of zero or more Unicode characters, wrapped   in double quotes, using backslash escapes. A character is represented as a   single character string. A string is very much like a C or Java string.</p>
<p style="text-align: justify;"><a href="http://www.json.org/string.gif"><img class="aligncenter" title="Json string" src="http://www.json.org/string.gif" alt="" width="598" height="413" /></a></p>
<p style="text-align: justify;">A <em>number</em> is very much like a C or Java number, except that the octal   and hexadecimal formats are not used.</p>
<p style="text-align: justify;"><a href="http://www.json.org/number.gif"><img class="aligncenter" title="JSON number" src="http://www.json.org/number.gif" alt="" width="598" height="266" /></a></p>
<h3><span style="color: #800000;"><strong>JSON Syntax</strong></span></h3>
<ul>
<li>For objects start the object with “{“ and end it with “}”</li>
<li>For members (properties), use pairs of string : value and separate them by commas</li>
<li>For arrays put the arrays between []</li>
<li>For elements put the values directly separated by commas</li>
</ul>
<p>Example:</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
var myFirstJSON = { &quot;firstName&quot; : &quot;Loiane&quot;,
                    &quot;lastName&quot;  : &quot;Groner&quot;,
                    &quot;age&quot;       : 23 };

document.writeln(myFirstJSON.firstName);  // Outputs Loiane
document.writeln(myFirstJSON.lastName);   // Outputs Groner
document.writeln(myFirstJSON.age);        // Outputs 23
&lt;/script&gt;
</pre>
<p>This object has 3 properties or name/value pairs. The firstName and lastName are strings and age is a number.</p>
<p>The value can be any Javascript object (and remember everything in Javascript is an object so the value can be a string, number, array, function, even other Objects).</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
var hobbies = { &quot;tvseries&quot; :
			[ //array
				{&quot;name&quot;: &quot;Lost&quot;, &quot;seasons&quot;:5 },
				{&quot;name&quot;: &quot;Heroes&quot;, &quot;seasons&quot;:4 },
				{&quot;name&quot;: &quot;Fringe&quot;, &quot;seasons&quot;:2 },
				{&quot;name&quot;: &quot;The Office&quot;, &quot;seasons&quot;:5 },
				{&quot;name&quot;: &quot;The Big Bang Theory&quot;, &quot;seasons&quot;:3 },
				{&quot;name&quot;: &quot;True Blood&quot;, &quot;seasons&quot;:2 },
				{&quot;name&quot;: &quot;Battlestar Galactica&quot;, &quot;seasons&quot;:4 },
				{&quot;name&quot;: &quot;Sex and the City&quot;, &quot;seasons&quot;:6 },
				{&quot;name&quot;: &quot;Friends&quot;, &quot;seasons&quot;:10 }
			]
			&quot;games&quot; :
				[
				&quot;Counter Strike&quot; ,&quot;Sacred 2&quot;,&quot;The Sims 3&quot;,&quot;Guitar Hero&quot;
				]

      		};

document.writeln(hobbies.tvseries[0].name); // Outputs Lost
document.writeln(hobbies.games[3]); 	   // Outputs Guitar Hero
&lt;/script&gt;
</pre>
<p><em>hobbies</em> is an object.  That object has two properties or name/value pair (<em>tvseries</em> and <em>games</em>).</p>
<p><em>tvseries</em> is an array which holds two JSON objects showing the names and seasons of 9 TV Series.  Likewise games is also an array which holds four JSON objects showing the names of games I like.</p>
<p>Well, this is just a start. You can study JSON functions and how to convert JSON objects now. You can also study Ajax toolkits taht support JSON.</p>
<p>Happy coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=66&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Nq3FzF6PDRU:MhKW_5Pnwzg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Nq3FzF6PDRU:MhKW_5Pnwzg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Nq3FzF6PDRU:MhKW_5Pnwzg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=Nq3FzF6PDRU:MhKW_5Pnwzg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Nq3FzF6PDRU:MhKW_5Pnwzg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Nq3FzF6PDRU:MhKW_5Pnwzg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=Nq3FzF6PDRU:MhKW_5Pnwzg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=Nq3FzF6PDRU:MhKW_5Pnwzg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/Nq3FzF6PDRU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2009/12/getting-started-with-json/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2009/12/getting-started-with-json/</feedburner:origLink></item>
		<item>
		<title>Significant Sun S/W releases today: NetBeans 6.8 + Java EE 6 + GlassFish Enterprise Server V3</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/VgW1kN48Ovs/</link>
		<comments>http://loianegroner.com/2009/12/significant-sun-sw-releases-today-netbeans-6-8-java-ee-6-glassfish-enterprise-server-v3/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 17:56:53 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[SUN]]></category>
		<category><![CDATA[Glassfish]]></category>
		<category><![CDATA[Java EE]]></category>
		<category><![CDATA[NetBeans]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=61</guid>
		<description><![CDATA[Sun released a couple of significant software releases today&#8230;Folks have been working hard to get these release(s) out. So, today, Sun and the NetBeans(TM) community are announcing the availability of the NetBeans Integrated Development Environment (IDE) 6.8 &#8212; in conjunction with the availability of Java(TM) Platform Enterprise Edition 6 (Java EE 6) and Sun GlassFish(TM) [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: justify;">Sun released a couple of significant software releases today&#8230;Folks have been working hard to get these release(s) out. So, today, Sun and the NetBeans(TM) community are <strong>announcing the availability of the NetBeans Integrated Development Environment (IDE) 6.8 &#8212; in conjunction with the availability of Java(TM) Platform Enterprise Edition 6 (Java EE 6) and Sun GlassFish(TM) Enterprise Server v3.</strong> &#8230;.and there&#8217;s a bit <strong>more to this.  The Software team is holding a virtual event for folks who want to <span style="text-decoration: underline;">learn more</span>: </strong></p>
<p style="text-align: justify;">
An <strong><span style="color: #006600;">on-line Virtual Conference will be held on December 15th</span></strong>.  Registration is at <a href="https://dct.sun.com/dct/forms/reg_us_2011_956_0.jsp" target="_blank">https://dct.sun.com/dct/forms/reg_us_2011_956_0.jsp</a>.</p>
<p style="text-align: justify;">
<h3 style="text-align: justify;"><strong><span style="text-decoration: underline;">KEY UPDATES TO JAVA EE 6</span><br />
</strong></h3>
<p style="text-align: justify;"><strong>New Developer Productivity Features:</strong> Java EE 6 features simplify Java application development with less XML configuration, more annotations and more POJO-like development.</p>
<p style="text-align: justify;"><strong>Support for New Specifications:</strong> New specifications are available including RESTful Web services, EJB 3.1 and EJB Lite, and Dependency Injection.</p>
<p style="text-align: justify;"><strong>Support for Profiles:</strong> Java EE 6 adds support for defining Profiles that may be a subset or superset of the traditional Java EE 6 full stack that are tailored to specific application scenarios or verticals.  One specific Profile is defined, the Web Profile, intended for the deployment of modern Web applications.</p>
<p style="text-align: justify;">Additional information is available at: <a href="http://netbeans.org/community/releases/68/" target="_blank">http://java.sun.com/javaee</a></p>
<p style="text-align: justify;">
<h3 style="text-align: justify;"><strong><span style="text-decoration: underline;">KEY UPDATES TO GLASSFISH ENTERPRISE SERVER V3</span></strong></h3>
<h3 style="text-align: justify;"><strong> </strong></h3>
<p style="text-align: justify;"><strong>Full Support for Java EE 6:</strong> GlassFish Enterprise Server v3 is the first application server to be compatible with the new Java EE 6 specification.</p>
<p style="text-align: justify;"><strong>New Modular Runtime:</strong> A new modular runtime based on OSGi provides for faster startup and loading only those components required, reducing resource requirements.</p>
<p style="text-align: justify;"><strong>GlassFish Web Profile:</strong> Implementing the new Java EE 6 Web Profile, this provides an lighter weight runtime optimized for modern Web applications.</p>
<p style="text-align: justify;"><strong>Support for Iterative Development:</strong> New features allow developers to use an edit, save, reload approach to development, eliminating the time consuming recompile and redeploy steps.  This is extended by application state being preserved eliminating the need to recreate that state after each change.  NetBeans 6.8 has been released providing full support for Java EE 6 development.</p>
<p style="text-align: justify;">Additional information is available at: <a href="http://netbeans.org/community/releases/68/" target="_blank">http://www.sun.com/glassfishv3</a></p>
<p style="text-align: justify;"><strong><br />
</strong></p>
<h3 style="text-align: justify;"><strong><span style="text-decoration: underline;">KEY UPDATES TO THE NETBEANS 6.8 IDE</span></strong></h3>
<p style="text-align: justify;">
The NetBeans IDE 6.8 is available for download free of charge at <a href="http://www.netbeans.org/" target="_blank">www.netbeans.org</a>.</p>
<p><strong>Complete Java EE 6 Support:</strong> Java EE 6 language features simplify Java application development with less XML configuration, more annotations and more POJO-like development.</p>
<p><strong>GlassFish v3 Support:</strong> Developers can easily target and deploy to GlassFish v3, including the new lightweight GlassFish v3 Web Profile.</p>
<p><strong>JavaFX(TM):</strong> The latest version of the NetBeans editor provides improved code completion, hints and navigation for JavaFX.</p>
<p><strong>PHP Support:</strong> The NetBeans IDE expands its support of dynamic languages with support for PHP 5.3 and the Symfony (open-source PHP) web framework.</p>
<p><strong>Tighter Integration with Project Kenai:</strong> Project Kenai, a collaborative environment for hosting open source projects, now delivers full support for JIRA and improved instant messenger and issue tracker integration. For more information visit <a href="http://www.kenai.com/" target="_blank">www.kenai.com</a>.</p>
<p><strong>C/C++ Profiling:</strong> The new Microstate Accounting indicator and I/O usage monitor help developers profile and tune C/C++ applications.</p>
<p><strong>NetBeans Platform:</strong> As a rock-solid application framework for Swing applications, the platform saves developers a huge amount of time and effort by providing commonly-used facilities such as menu items, toolbar items, keyboard shortcuts, and window management out of the box.</p>
<p><span style="color: #800000;">Additional information is available at</span>:</p>
<p>NetBeans 6.8 IDE -  <a href="http://netbeans.org/community/releases/68/" target="_blank">http://netbeans.org/community/releases/68/</a><br />
Java EE 6 &#8211; <a href="http://java.sun.com/javaee/" target="_blank">http://java.sun.com/javaee/</a><br />
GlassFish v3 &#8211; <a href="http://www.sun.com/glassfishv3" target="_blank">http://www.sun.com/glassfishv3</a></p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=61&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VgW1kN48Ovs:CEim8zqaisg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VgW1kN48Ovs:CEim8zqaisg:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VgW1kN48Ovs:CEim8zqaisg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=VgW1kN48Ovs:CEim8zqaisg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VgW1kN48Ovs:CEim8zqaisg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VgW1kN48Ovs:CEim8zqaisg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=VgW1kN48Ovs:CEim8zqaisg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=VgW1kN48Ovs:CEim8zqaisg:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/VgW1kN48Ovs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2009/12/significant-sun-sw-releases-today-netbeans-6-8-java-ee-6-glassfish-enterprise-server-v3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2009/12/significant-sun-sw-releases-today-netbeans-6-8-java-ee-6-glassfish-enterprise-server-v3/</feedburner:origLink></item>
		<item>
		<title>Getting started with ExtJS in your J2EE project</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/wHbVwWLLnGk/</link>
		<comments>http://loianegroner.com/2009/12/getting-started-with-extjs-in-your-j2ee-project/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 10:00:33 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[ExtJS + J2EE]]></category>
		<category><![CDATA[Hello World ExtJS]]></category>
		<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=48</guid>
		<description><![CDATA[This tutorial will walk through how to get an Ext JS installation up and running quickly in your java (J2EE) project. Level: Basic This is the screenshot of this tutorial: First, if you haven&#8217;t downloaded ExtJS already, do it: http://extjs.com/products/extjs/download.php (most current release). PS.: I&#8217;m using Eclipse IDE. 1 - After download the ExtJS library, [...]]]></description>
			<content:encoded><![CDATA[
<p>This tutorial will walk through how to get an <a href="http://www.extjs.com" target="_blank">Ext JS</a> installation up and running quickly in your java (J2EE) project.</p>
<p>Level: <strong>Basic</strong></p>
<p>This is the screenshot of this tutorial:</p>
<p><img class="aligncenter size-full wp-image-51" title="getting_started_extjs_java_01" src="http://loianegroner.com/wp-content/uploads/2009/11/getting_started_extjs_java_01.jpg" alt="getting_started_extjs_java_01" width="501" height="253" /></p>
<p>First, if you haven&#8217;t downloaded ExtJS already, do it: <a title="http://extjs.com/products/extjs/download.php" rel="nofollow" href="http://extjs.com/products/extjs/download.php">http://extjs.com/products/extjs/download.php</a> (most current release).</p>
<p>PS.: I&#8217;m using <a href="http://eclipse.org/" target="_blank">Eclipse IDE</a>.</p>
<p><strong>1 -</strong> After download the ExtJS library, let&#8217;s create a Dynamic Web Project.</p>
<p><strong>2 </strong>- Under WebContent folder, create a folder where all ExtJS files will be located (I named it ext-3.0.3). Paste adapter and resources folders under your extjs folder. Also, paste this file:  <em>ext-all.js </em>under<em> ext-3.0.3</em>:</p>
<p><img class="aligncenter size-full wp-image-54" title="getting_started_extjs_java_02" src="http://loianegroner.com/wp-content/uploads/2009/11/getting_started_extjs_java_02.jpg" alt="getting_started_extjs_java_02" width="243" height="292" /></p>
<p><strong>3 -</strong> Let&#8217;s create a html page. You can use this page as a template and adjust it to your needs:</p>
<pre class="brush: xml; toolbar: true;">
&lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=ISO-8859-1&quot;
    pageEncoding=&quot;ISO-8859-1&quot;%&gt;
&lt;html&gt;
&lt;head&gt;

	&lt;!-- Ext relies on its default css so include it here. --&gt;
  	&lt;!-- This must come BEFORE javascript includes! --&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/extjs-helloworld/ext-3.0.3/resources/css/ext-all.css&quot; /&gt;

	&lt;!-- Include here your own css files if you have them. --&gt;

	&lt;!-- First of javascript includes must be an adapter... --&gt;
	&lt;script src=&quot;/extjs-helloworld/ext-3.0.3/adapter/ext/ext-base.js&quot;&gt;&lt;/script&gt;

	&lt;!-- ...then you need the Ext itself, either debug or production version. --&gt;
	&lt;script src=&quot;/extjs-helloworld/ext-3.0.3/ext-all.js&quot;&gt;&lt;/script&gt;

	&lt;!-- Include here your extended classes if you have some. --&gt;

  	&lt;!-- Include here you application javascript file if you have it. --&gt;

	&lt;title&gt;Getting Started with Extjs&lt;/title&gt;

	&lt;!-- You can have onReady function here or in your application file. --&gt;
  	&lt;!-- If you have it in your application file delete the whole --&gt;
  	&lt;!-- following script tag as we must have only one onReady. --&gt;

	&lt;script type=&quot;text/javascript&quot;&gt;

	// Path to the blank image must point to a valid location on your server
	Ext.BLANK_IMAGE_URL = '/extjs-helloworld/ext-3.0.3/resources/images/default/s.gif';

	&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>4 -</strong> Now, let&#8217;s put a Hello World code to make sure everything is ok:</p>
<pre class="brush: jscript; toolbar: true;">
	Ext.onReady(function(){
		Ext.Msg.alert('Test Extjs', 'Hello World');
	});
</pre>
<p>You can download the source code in my Github: <a href="http://github.com/loiane/extjs-helloworld" target="_blank"><img class="alignnone size-full wp-image-1238" title="public" src="http://www.loiane.com/wp-content/uploads/2009/11/public.png" alt="public" width="16" height="16" /> http://github.com/loiane/extjs-helloworld</a></p>
<p>Reference: <a href="http://www.extjs.com" target="_blank">Ext Js Communit</a>y</p>
<p>Happy Coding!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=48&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=wHbVwWLLnGk:ies2TWD2RJY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=wHbVwWLLnGk:ies2TWD2RJY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=wHbVwWLLnGk:ies2TWD2RJY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=wHbVwWLLnGk:ies2TWD2RJY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=wHbVwWLLnGk:ies2TWD2RJY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=wHbVwWLLnGk:ies2TWD2RJY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=wHbVwWLLnGk:ies2TWD2RJY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=wHbVwWLLnGk:ies2TWD2RJY:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/wHbVwWLLnGk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2009/12/getting-started-with-extjs-in-your-j2ee-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2009/12/getting-started-with-extjs-in-your-j2ee-project/</feedburner:origLink></item>
		<item>
		<title>Ext JS: Which events are fired by a component?</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/AlVSr3JBbLI/</link>
		<comments>http://loianegroner.com/2009/11/ext-js-which-events-are-fired-by-a-component/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 09:00:21 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[events ExtJS]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=42</guid>
		<description><![CDATA[Quick Tip: Sometimes, we need to know all events that are fired by an Ext JS component. It is easy to find out, just use the following code in Firebug: Ext.util.Observable.capture(Ext.getCmp('id_my_grid'), console.info); For example: let&#8217;s say that the component you want to analyze has id &#8220;id_my_grid&#8221;. Load the page with the component (project) using Firefox, [...]]]></description>
			<content:encoded><![CDATA[
<h3><a href="http://www.loiane.com/wp-content/uploads/2009/10/mb_extjs_splash.jpg" target="_blank"><img class="aligncenter" title="extjs eventes fired" src="http://www.loiane.com/wp-content/uploads/2009/10/mb_extjs_splash.jpg" alt="" width="162" height="102" /></a><strong>Quick Tip:</strong></h3>
<p>Sometimes, we need to know all events that are fired by an Ext JS component.</p>
<p>It is easy to find out, just use the following code in Firebug:</p>
<pre class="brush: jscript; toolbar: true;">Ext.util.Observable.capture(Ext.getCmp('id_my_grid'), console.info);</pre>
<p>For example: let&#8217;s say that the component you want to analyze has id &#8220;id_my_grid&#8221;. Load the page with the component (project) using Firefox, open Firebug, Console tab and use the code above.</p>
<p>Now do some actions with the component and watch the Firebug output.</p>
<p>Happy coding and debuging!</p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=42&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=AlVSr3JBbLI:x1n01jv1uE0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=AlVSr3JBbLI:x1n01jv1uE0:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=AlVSr3JBbLI:x1n01jv1uE0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=AlVSr3JBbLI:x1n01jv1uE0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=AlVSr3JBbLI:x1n01jv1uE0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=AlVSr3JBbLI:x1n01jv1uE0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=AlVSr3JBbLI:x1n01jv1uE0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=AlVSr3JBbLI:x1n01jv1uE0:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/AlVSr3JBbLI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2009/11/ext-js-which-events-are-fired-by-a-component/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2009/11/ext-js-which-events-are-fired-by-a-component/</feedburner:origLink></item>
		<item>
		<title>Tutorial: Using the EGit Eclipse Plugin with GitHub</title>
		<link>http://feedproxy.google.com/~r/LoianeGroner/~3/rUSerurWlt8/</link>
		<comments>http://loianegroner.com/2009/11/tutorial-using-the-egit-eclipse-plugin-with-github/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 09:00:22 +0000</pubDate>
		<dc:creator>Loiane</dc:creator>
				<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Auth Fail Egit]]></category>
		<category><![CDATA[Egit]]></category>
		<category><![CDATA[Git]]></category>

		<guid isPermaLink="false">http://loianegroner.com/?p=28</guid>
		<description><![CDATA[I started to use GitHub a couple of months ago. I found this Elipse plugin – EGit - and it did made my life so much easier (download projects from GitHub and upload projects &#8211; with may files &#8211; to GitHub). So I decided to write this tutorial, because I did not find any step [...]]]></description>
			<content:encoded><![CDATA[
<p style="text-align: center;"><a href="http://www.loiane.com/wp-content/uploads/2009/10/octocat_happy.gif" target="_blank"><img class=" aligncenter" title="github" src="http://www.loiane.com/wp-content/uploads/2009/10/octocat_happy.gif" alt="github, tutorial egit github, egit, git" width="264" height="201" /></a></p>
<p>I started to use <a href="http://github.com/" target="_blank">GitHub </a>a couple of months ago.</p>
<p><span style="line-height: 23px;">I found this Elipse plugin – <a style="color: #708226; text-decoration: none; padding: 0px; margin: 0px;" href="http://code.google.com/p/egit/" target="_blank">EGit </a>- and it did made my life so much easier (download projects from GitHub and upload projects &#8211; with may files &#8211; to GitHub). So I decided to write this tutorial, because I did not find any step by step Egit tutorial on the Internet</span></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.8em; padding: 0px;">What this tutorial covers:</p>
<ul>
<li><span style="line-height: 19px; ">Installing EGit</span></li>
<li><span style="line-height: 19px; ">Importing an existing Eclipse project from Github</span></li>
<li>Uploading your Eclipse project to Github</li>
<li>Git operations from inside Eclipse</li>
</ul>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; line-height: 1.8em; padding: 0px;">Enjoy it and Happy coding!</p>
<p style="text-align: center;"><object width="425" height="348"><param name="movie" value="http://static.slideshare.net/swf/ssplayerd.swf?doc=usingtheegiteclipsepluginwithgithub-091124185958-phpapp01"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayerd.swf?doc=usingtheegiteclipsepluginwithgithub-091124185958-phpapp01"  type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="348"></embed></object></p>

<img src="http://loianegroner.com/?ak_action=api_record_view&id=28&type=feed" alt="" /><p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://loianegroner.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=rUSerurWlt8:NkXjeBNsNMw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=rUSerurWlt8:NkXjeBNsNMw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=rUSerurWlt8:NkXjeBNsNMw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=rUSerurWlt8:NkXjeBNsNMw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=rUSerurWlt8:NkXjeBNsNMw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=rUSerurWlt8:NkXjeBNsNMw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?i=rUSerurWlt8:NkXjeBNsNMw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LoianeGroner?a=rUSerurWlt8:NkXjeBNsNMw:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/LoianeGroner?d=I9og5sOYxJI" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LoianeGroner/~4/rUSerurWlt8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://loianegroner.com/2009/11/tutorial-using-the-egit-eclipse-plugin-with-github/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://loianegroner.com/2009/11/tutorial-using-the-egit-eclipse-plugin-with-github/</feedburner:origLink></item>
	</channel>
</rss>
