struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Gainty <mgai...@hotmail.com>
Subject RE: int's and OGNL in struts.xml
Date Thu, 01 Apr 2010 21:29:46 GMT

you can get/string widths with struts-2.1.8 ChartResult

 

    public String getWidth() {
        return width;
    }

    public void setWidth(String width) {
        this.width = width;
    }

 

http://struts.apache.org/download.cgi

hth
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.



 

> Date: Thu, 1 Apr 2010 11:07:34 -0700
> Subject: int's and OGNL in struts.xml
> From: thechrispratt@gmail.com
> To: user@struts.apache.org
> 
> I'm trying to use the OGNL support in Struts 2.0.14 to set some parameter
> values in the jFreeChart plugin's chart result type. But I keep getting
> errors because it appears to be expecting all properties to be Strings, even
> if the OGNL doesn't return a String. I'm using:
> 
> <action name="chart-frame-selection-rate"
> class="com.vsp.global.controller.ChartFrameSelectionRateAction">
> <param name="role">user</param>
> <result type="chart">
> <param name="width">${@com.example.Config@getInt("reports","frameSelectionRate.width")}</param>
> <param name="height">${@com.example.Config@getInt("reports","frameSelectionRate.height")}</param>
> </result>
> <result name="failure" type="httpheader">404</result>
> </action>
> 
> Where
> 
> where com.example.Config.getInt is defined as
> 
> public int getInt (String domain,String key);
> 
> 
> But when struts tries to instantiate the result I get:
> 
> [2010-04-01 10:46:57,785] ERROR {abcOu3jlPU3Rf_9tFPSzs}
> DefaultActionInvocation.createResult: There was an exception while
> instantiating the result of type org.apache.struts2.dispatcher.ChartResult
> Caught OgnlException while setting property 'width' on type
> 'org.apache.struts2.dispatcher.ChartResult'. - Class: ognl.OgnlRuntime
> File: OgnlRuntime.java
> Method: callAppropriateMethod
> Line: 1206 - ognl/OgnlRuntime.java:1206:-1
> at
> com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java:367)
> at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76)
> .
> .
> .
> Caused by: java.lang.NoSuchMethodException:
> org.apache.struts2.dispatcher.ChartResult.setWidth(java.lang.String)
> at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1206)
> at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1454)
> at
> ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85)
> at
> ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162)
> 
> 
> Is there any way to make struts recognize that the value is an int, so it
> needs to call setWidth(int)?
> (*Chris*)
 		 	   		  
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID27925::T:WLMTAGL:ON:WL:en-US:WM_HMP:032010_1
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message