hey guys,im new to flex.im nt being able 2 access data frm mysql database using jsp page in flex.the jsp page is workin fine as it is fetching data widout flex but wid flex..data is not getting displayed. Here's my mxml page.
l version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" minWidth="955" minHeight="600" xmlns:srv="services.srv.*">
<fx

eclarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<mx:HTTPService id="srv" url="http://localhost:8080/examples/second3.jsp" resultFormat="object"/>
</fx

eclarations>
<mx:Button label="Get Data" click="srv.send()"/>
<mx

ataGrid dataProvider="{srv.lastResult}" x="79" y="57" id="dataGrid"
<mx:columns>
<mx

ataGridColumn headerText="name" dataField="name"/>
<mx

ataGridColumn headerText="age" dataField="age"/>
</mx:columns>
</mx

ataGrid>
</mx:Application>
In the dataprovider property i've given "httpserviceid.lastResult"..i dont know what lastResult is ..i jst googled and found this written evrywhere so i used it..but the data dint get fetched.So i removed the datagrid part frm the code and switched to the design mode.Then
I dragged a datagrid component,right clikd it,clikd bindData,then configure return type ,then autodetect return type,then cliked the radio button stating "enter url with parameters to get it" and typed the url.."http://localhost:8080/examples/second3.jsp" but then the following showed up..
The response is not a valid XML or a JSON string..
Now i donno where im going wrong.i searched google but evrywhere there r articles accessing database thru xml in flex..here's my jsp page.(its in examples folder of tomcat)..
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%! Connection con=null; %>
<%! Statement st= null; %>
<%! ResultSet rs= null; %>
<html>
<head><title>This is a Jdbc Example</title></head>
<body>
<%
out.println("Arun K Chanumalla");
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
}catch(ClassNotFoundException ce){out.println(ce);}
try{
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/proj","root", "tamgam");
st = con.createStatement();
rs = st.executeQuery("SELECT name, age FROM first");
while(rs.next()) {
String name = rs.getString(1);
int age = rs.getInt(2);
out.println(name +"<br>");
out.println(age);
} // end of whilee
rs.close();
st.close();
con.close();
}catch(SQLException exception){
out.println("<!--");
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
exception.printStackTrace(pw);
out.print(sw);
sw.close();
pw.close();
out.println("-->");
}
%>
</body>
</html>
pls if anybody could tell me the right way to proceed..i'd b thankful...