Hi,
I am doing a simple CURD using Struts 2 and Hibernatge3. I am using a Long
type in my bean for a property as
     private Long priceMrp;

Since this property has a Long type, its getter and setter correspondingly
use Long type in the model bean.

 public Long getPriceMrp() {
        return this.priceMrp;
    }

    public void setPriceMrp(Long priceMrp) {
        this.priceMrpPerPiece = priceMrp;
    }

In my action I am creating a private object for this model with getter and
setter and using <s:textfield to pass input to these fields.

<s:textfield required="true" requiredposition="left" maxLength="10"
label="MRP" name="price.priceMrp" title="Enter price "/>

While evaluating the framework is expecting getter and setter to be using
String and since it does not find them an ognl expression is being thrown as
follows:

[#|2009-06-09T02:09:30.504+0530|WARNING|sun-appserver9.1|com.opensymphony.xwork2.ognl.OgnlValueStack|_ThreadID=19;_ThreadName=httpSSLWorkerThread-14859-1;_RequestID=989f204d-78dd-4aae-9835-fddb0969e318;|Error
setting value
ognl.MethodFailedException: Method "setPriceMrpPerPiece" failed for object
com.sagri.app.model.pr...@47808b [java.lang.NoSuchMethodException:
setPriceMrp([Ljava.lang.String;)]
 at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823)


I want to know if there is any standard way to solve this problem in Struts
2. What is the best way to address this problem.

Should i create the property priceMrp in my action and have it use "String"
type then do the assignment myself like
price.setpriceMrp( Long.valueOf("strPriceValue"); //is this approach valid

Please suggest. Thanks in Advance
Abdul Sagri

Reply via email to