开发者

GWT and Response Object Problem

开发者 https://www.devze.com 2023-03-13 22:13 出处:网络
OK so this is a very strange problem. I have a servlet running on my machine that return开发者_JAVA百科s XML code for use in fusion charts. I know the server is writing the data to to the stream becau

OK so this is a very strange problem. I have a servlet running on my machine that return开发者_JAVA百科s XML code for use in fusion charts. I know the server is writing the data to to the stream because I have it printing out what it is writing. Which looks like this:

Data: "<chart caption='FusionChart' xAxisName='Month in 1200' yAxisName='Men Killed'>" + "<set label='January' value='10.0' />" + "<set label='February' value='13.0' />" + "<set label='March' value='18.0' />" + "<set label='April' value='12.0' />" + "<set label='May' value='22.0' />" + "<set label='June' value='14.0' />" + "<set label='July' value='18.0' />" + "<set label='August' value='12.0' />" + "<set label='September' value='14.0' />" + "<set label='October' value='10.0' />" + "<set label='November' value='19.0' />" + "<set label='December' value='15.0' />" + "</chart>"

Now heres the strange part when GWT 2.3 gets the data from a response and is shown in an alert window or an HTML widget all it shows is "" + "" + "" + "" + "" + "" + "" + "" and so on. Its like all the XML data was stripped out. Anyone know a reason for that?

Thanks.


How are you adding the returned data to the DOM? If you're treating it as raw HTML (e.g. calling setInnerHtml()) that would explain the behavior that you're seeing. If you inspect the DOM structure with FireBug/WebInspector, do you see a <chart> element?

Depending on the widget that you're using to display the XML, you'll want something like setInnerText().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号