javahibernatestruts2ognlactionresult

ognl.NoSuchPropertyException: org.apache.struts2.dispatcher.ServletActionRedirectResult.applicationId


I am using Hibernate 3.0 and Struts 2. I am using @GeneratedValue for the id generation.

I have one customer screen when I save the customer details, I want to move to the next screen with the newly inserted customerId, because based on that ID only, I will save the second page details

for that I am using like

someDAO.save(customer);
customerId = customer.getCustomerId();

I get the customer object value after save and using Struts 2 redirectAction I forward the customerId to second page, it is working fine but I am getting WARN in my console:

Caught OgnlException while setting property 'applicationId' on type 'org.apache.struts2.dispatcher.ServletActionRedirectResult'.
ognl.NoSuchPropertyException: org.apache.struts2.dispatcher.ServletActionRedirectResult.applicationId
    at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132)
    at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68)
    at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
    at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
    at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
    at ognl.SimpleNode.setValue(SimpleNode.java:246)

Solution

  • Best way You can ignore this,

    However redirectAction uses the ActionMapper provided by the ActionMapperFactory to redirect the browser to a URL that invokes the specified action and (optional) namespace. The OGNL try to set the map html elements with values specified on source page and push these values in the valuestack. sometimes OGNL attempts to map values with setters which is specified in the action class with the source -page and failed to set the values and resulted in warning.

    you can try explicitly assigning the param's to suppress warning :

    <result name="showReportResult" type="redirectAction">
         <param name="applicationId">${applicationId}</param>
     </result>