Sending data from flex to JSP using HTTPservice

November 20, 2007

Here is an example to post data from flex to JSP using httpservice. We’ll put a simple form under the data grid above to enter the data about the new employee and Pressing the Add Employee button will submit the entered data to the JSP, which will attach them to existing employees and return back so the data grid can be repopulated to include the newly inserted employee.

Here is code for Employee entry and Data grid.

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”; layout=”absolute” applicationComplete=”employees.send()”>
import mx.controls.Alert;
private function validateEmpName():void{
if (empNameValidator.validate().type == ValidationResultEvent.VALID)
{“Employee name can not be blank”);

private function submitForm():void


private function onResult(event:Event):void


<mx:Model id=”employeeModel”>


<mx:HTTPService id=”employees” useProxy=”false” method=”POST” url=”employee.jsp”/>
<mx:DataGrid dataProvider=”{employees.lastResult.people.person}” width=”50%”>
<mx:DataGridColumn dataField=”name” headerText=”Name” />
<mx:DataGridColumn dataField=”age” headerText=”Age”/>
<mx:DataGridColumn dataField=”skills” headerText=”Skills”/>


<mx:StringValidator id=”empNameValidator” source=”{empName}” property=”text” triggerEvent=””/>
<mx:Form width=”100%” height=”100%” x=”50″ y=”400″>
<mx:FormItem label=”Enter name:” required=”true”>
<mx:TextInput id=”empName” />
<mx:FormItem label=”Enter age:”>
<mx:TextInput id=”age” />
<mx:FormItem label=”Enter skills”>
<mx:TextInput id=”skills” />

<mx:Button label=”Add Employee” click=”validateEmpName()”/>



here is code for employee.jsp
String employees=”<?xml version=\’1.0\’ encoding=\’UTF-8\’?><people><person><name>Alex</name><age>22</age><skills>java, HTML, SQL</skills></person><person><name>Brandon Smith</name><age>21</age><skills>PowerScript, JavaScript, ActionScript</skills></person><person><name>Jeremy Plant</name><age>20</age><skills>SQL, C++, Java</skills></person>”;

String name=request.getParameter(“empName”);
String age=request.getParameter(“age”);
String skills=request.getParameter(“skills”);
String newEmployee =”<person><name>” + name+ “</name><age>” + age + “</age><skills>”+ skills +”</skills></person>”;

if (name == null){
 out.println(employees + newEmployee + “</people>”);

Adobe AIR mp3 Player

October 8, 2007

Presenting desktop mp3 player completely done in Adobe AIR.

Player Screenshot

In this you can select any music folder using add file button, it will automatically select all mp3 file from that particular folder.

This application includes following features.
1. Adding files in playlist using add button.
2. Play, stop, next, previous song button,
3. Repeat & Suffle Button with it’s functionality
4. Sound Control
5. Visual control(Third party)
6. Playing bar with remaining time and played time.
7. Song info – Album name, Title and Artist
8. Marquee for current playing track
9. Load Playlist
10. Remove selected track from list
11. Select all

The Application is skinnable, you can change the skin which is there in skin folder.

You can donwload the player from here.