According to you description, you have two separate applications. One is running under Apache and one under Tomcat. In this case, you are trying to get some data from a different URL. Therefore I would use the '* RequestBuilder*' instance to fetch some data.
Try out this example: http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideHttpRequests I hope it helps or at least it's a hint. Dariusz On Tue, Jan 6, 2009 at 3:15 AM, yi dan <[email protected]> wrote: > hi, guys, > > my gwt-ext application need to load data to a chart. i use a php file to > read data from my local MySQL server. however in both hosted mode and web > mode, the php file return itself instead of JSON data. if i deploy the whole > application to my apache server, php file can return JSON data. my guess is > the embedded tomcat doesn't enable local mysql server, my question is how > can i make tomcat and mysql work together so i can debug my gwt-ext > application in eclipse? Thanks!!!! > > i post my code as below: > > *php file : (which is save at /public/data/ directory) * > <?php > header('Content-Type: text/javascript'); > echo '{'; > echo "\"rates\":"; > echo '['; > > $link = mysql_connect('localhost', 'root', 'hello'); > > mysql_select_db('hoana'); > $query = 'select * from hrrr limit 3'; > $result = mysql_query($query); > > $i = 0; > > while($row = mysql_fetch_array($result, MYSQL_NUM)) { > > echo '{'; > echo "\"step\":\"$row[0]\","; > echo "\"rate\":\"$row[1]\""; > echo '}'; > > if($i < (mysql_num_rows($result)-1)) { > echo ','; > } > $i++; > } > echo ']'; > echo '}'; > > mysql_free_result($result); > mysql_close($link); > > ?> > > *JSON returned:* > > {"rates":[{"step":"0","rate":"14.88"},{"step":"1","rate":"14.39"},{"step":"2","rate":"14.01"}]} > > *gwt-ext code: > * HttpProxy dataProxy = new HttpProxy("data/getData1.php"); > final RecordDef recordDef = new RecordDef(new > FieldDef[]{ > new StringFieldDef("step"), > new FloatFieldDef("rate") > }); > > JsonReader reader = new JsonReader(recordDef); > reader.setRoot("rates"); > > Store store = new Store(dataProxy, reader); > store.load(); > > SeriesDefY[] seriesDef = new SeriesDefY[]{ > new SeriesDefY("rate", "rate") > }; > > NumericAxis currencyAxis = new NumericAxis(); > currencyAxis.setMinimum(5); > //currencyAxis.setMaximum(35); > currencyAxis.setLabelFunction("formatCurrencyAxisLabel"); > LineChart chart = new LineChart(); > chart.setWMode("transparent"); > chart.setStore(store); > chart.setSeries(seriesDef); > chart.setXField("step"); > chart.setYAxis(currencyAxis); > chart.setDataTipFunction("getDataTipText"); > chart.setExpressInstall("js/yui/assets/expressinstall.swf"); > > chart.setWidth(500); > chart.setHeight(400); > *... > * > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "GWT-Ext Developer Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/gwt-ext?hl=en -~----------~----~----~----~------~----~------~--~---
