Tuesday, October 2, 2012

Java CSV file Import and parsing using opencsv library

We often need to import data from a CSV file to populate a relational database table. Most of the examples I have seen use the StringTokenizer to import a CSV file but that has its limitations such as if you come across data that has a comma in them. That's when I found this open source project called opencsv. It's a very simple csv (comma-separated values) parser library for Java. It takes care of the basic stuff such as comma inside the data itself and more. Also you can use the library to create CSV files. In addition to all that the best part...

ExtJs Grid JSON Java Servlet example with Grid Filter using TriggerField

In the previous chapter we have looked into the sample source codes for creating the grid panel using ExtJs, here we are going to work on the Java Servlet program that will get us the data from MySQL database in the form of a JSON object. ExtJs Grid JSON Java Servlet example with Grid Filter using TriggerField Step 7: MySQL JDBC data source context.xml    <?xml version="1.0" encoding="UTF-8"?> <Context reloadable="true"> <Resource auth="Container" name="jdbc/mysql" type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/world" username="root" password="mysql" maxIdle="10" maxActive="200" maxWait="5" removeAbandoned="true" removeAbandonedTimeout="1200" /> </Context> Step...

ExtJs 4 Grid Editing Tutorial based on CellEditing plugin using Java Servlet, JSON and MySQL database

The Ext.grid.plugin.CellEditing plugin injects editing at a cell level for a Grid. Only a single cell will be editable at a time. The field that will be used for the editor is defined at the editor. If an editor is not specified for a particular column then that cell will not be editable and it will be skipped when activated via the mouse or the keyboard. This tutorial will cover the following topics ... Connection to a Customer Table in MySQL database Get list of customers as JSON array...

ExtJs Rich Text Editor Example

An online rich-text editor is an interface for editing valid HTML markup making it easy for users trying to express their formatting directly as they see it. In this example we are going to display a Product and some Information about it. When the user clicks on the Edit Button it will open the Rich Text Editor for editing the information and then clicking on the save button will close the HTML editor and display the information that was just entered. This is very useful for inline editing...