Does implementing ParameterAware work? --- Phil404 <[EMAIL PROTECTED]> wrote:
> > That does not seem to work either. The String > values are nulls. > > Phil > > > Richard Yee wrote: > > > > You might try changing the attributes and setters > to Strings and see if > > that works. > > > > -Richard > > > > > > Phil404 wrote: > >> I would like to draw a Pie Chart using > JFreeChart. I call the action > >> from a > >> JSP like so: > >> > >> <s:url id='chartUrl' action='piechart'> > >> <s:param name='visual'>10</s:param> > >> <s:param name='auditory'>15</s:param> > >> <s:param name='kinesthetic'>20</s:param> > >> </s:url> > >> ${chartUrl} > >> > >> The action is very simple: > >> > >> public class PieChartAction extends ActionSupport > { > >> > >> private JFreeChart chart; > >> private int visual; > >> private int auditory; > >> private int kinesthetic; > >> > >> public String execute() { > >> System.out.println("Visual: " + getVisual()); > >> System.out.println("Auditory: " + > getAuditory()); > >> System.out.println("Kinesthetic: " + > getKinesthetic()); > >> DefaultPieDataset pieDataset = new > DefaultPieDataset(); > >> pieDataset.setValue("Visual", getVisual()); > >> pieDataset.setValue("Auditory", getAuditory()); > >> pieDataset.setValue("Kinesthetic", > getKinesthetic()); > >> chart = ChartFactory.createPieChart("Learning > Profile", pieDataset, > >> true, > >> true, false); > >> return SUCCESS; > >> } > >> > >> public JFreeChart getChart() { > >> return chart; > >> } > >> > >> public int getVisual() { > >> return visual; > >> } > >> > >> public void setVisual(int visual) { > >> this.visual = visual; > >> } > >> > >> public int getAuditory() { > >> return auditory; > >> } > >> > >> public void setAuditory(int auditory) { > >> this.auditory = auditory; > >> } > >> > >> public int getKinesthetic() { > >> return kinesthetic; > >> } > >> > >> public void setKinesthetic(int kinesthetic) { > >> this.kinesthetic = kinesthetic; > >> } > >> > >> } > >> > >> > >> The action is defined in the struts.xml like so: > >> > >> <package name="charts" > extends="jfreechart-default"> > >> <action name="piechart" class="pieChartAction"> > >> <result name="success" type="chart"> > >> 400 > >> 300 > >> </result> > >> </action> > >> </package> > >> > >> The issue is that the variables visual, auditory > and kinesthetic are not > >> being set in the Action. The values are > therefore always 0. Can someone > >> please tell me what I'm doing wrong? > >> > >> Phil > >> > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > -- > View this message in context: > http://www.nabble.com/Newbie-question-about-parameters-for-an-Action-tf4506130.html#a12852928 > Sent from the Struts - User mailing list archive at > Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]