wood burning stoves 2.0*
The moose likes Struts and the fly likes Calling a static method with a struts variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Calling a static method with a struts variable" Watch "Calling a static method with a struts variable" New topic
Author

Calling a static method with a struts variable

Frank Bueckert
Greenhorn

Joined: Mar 23, 2006
Posts: 8
Not exactly sure how to go about this. I'm using the JFreeChart jar file to generate a dynamic image based on the data I'm using. That's all fine and dandy.
My problem is accessing a variable I'm defining in the action, and using it in a scriptlet to write an imagemap straight into the JSP.

This defines the variable for the JSP. That part works fine. However, when I try to use it in a scriptlet, it turns up as null.


I've tried using "info", "(org.jfree.chart.ChartRenderingInfo) info", and any other variations I can come up with. I know I'm doing something wrong, but I have no idea what.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can't nest one Struts tag inside another.

change your <bean:define>tag to:

<bean:define id="info" type="org.jfree.chart.ChartRenderingInfo" scope="page" name="graphForm" property="info"/>

If you do this, your scriptlet should work.

You could also try getting the info bean directly from the ActionForm, as in:

[ July 18, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
jQuery in Action, 2nd edition
 
subject: Calling a static method with a struts variable
 
Similar Threads
How do i get form value in a local variable in the view JSP??
dynamic logic:iterate
Scripting varibale of type Vector
scitping variables
bean:define not working in logic:iterate