Sign in to follow this  
Scorcher

How I Do Get Return Value From My Server On Struts Environment

Recommended Posts

Hello.

 

I am using FusionWidget specially Real-time graph.

 

These day, I set on Real-time graph on my tomcat 7 server.

 

When I run example code on Documents in official FusionWidget homepage, I can see graph but It doesn't update itself.

 

HTML page as below.

===========================================================================

<HTML>

<HEAD>

<TITLE>FusionWidgets v3 - Multiple dataset example</TITLE>

<script type="text/javascript" src="../Charts/FusionCharts.js"></script>

</HEAD>

<BODY>

<CENTER>

<div id="chart1div">

This text is replaced by the Flash movie.

</div>

<script type="text/javascript">

var chart1 = new FusionCharts("../Charts/RealTimeLine.swf", "ChId1", "900", "350", "0", "0");

chart1.setDataURL("Control1.xml");

chart1.render("chart1div");

</script>

</BODY>

</HTML>

===========================================================================

 

Control1.xml

===========================================================================

<chart caption='CPU Usage' subCaption='Grape for CPU Usage' dataStreamURL='GetCPU.action' refreshInterval='2' setAdaptiveYMin='1' xAxisName='Time' showRealTimeValue='1' labelDisplay='Rotate' slantLabels='1' numDisplaySets='20'>

 

<dataset seriesName='CPU' showValues='0'>

 

</dataset>

 

<styles>

<definition>

<style type='font' name='captionFont' size='14' />

</definition>

<application>

<apply toObject='Caption' styles='captionFont' />

<apply toObject='Realtimevalue' styles='captionFont' />

</application>

</styles>

</chart>

===========================================================================

 

partion of struts.xml

===========================================================================

 

<package name="notice" extends="struts-default">

 

<result-types>

<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>

</result-types>

 

<action name="GetCPU" class="com.information.GetCPUAction">

<interceptor-ref name="prepare"/>

<interceptor-ref name="modelDriven"/>

<interceptor-ref name="params"/>

<result name="success">./Result/NewFile.jsp</result>

</action>

 

</package>

 

===========================================================================

 

 

NewFile.jsp

===========================================================================

 

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ taglib prefix="s" uri="/struts-tags" %>&label=<s:property value="time"/>&value=<s:property value="cpu"/>

 

===========================================================================

 

 

 

 

 

 

Because I running this page on Tomcat 7 with Struts 2, I set dataStreamURL like that.

 

Moreover, I already check that com.information.GetCPUAction.class was running after "GetCPU.action"

 

When I input "GetCPU.action" on my browser, I can see "&label=10:34:12&value=71.98".

 

It is perfectly same as that default JSP result

 

When I changed dataStreamURL like "xxxx.jsp", it worked!

 

Why Chart can not update this data? Could you help me?

 

 

 

summary

===================

1. I can saw graph from loading Control.html, but It doesn't update data

 

2. I checked that graph call GetCPU.action and associated class was runing.

 

3. And I can see return data value on my browser by inputing rawURL

post-35911-0-33164500-1359511060_thumb.png

post-35911-0-20400400-1359511065_thumb.png

post-35911-0-76964300-1359511162_thumb.png

Edited by Scorcher

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this