Question

I have two action classes which work with same model over ModelDriven interface. Every action class works with form. I need to store values to same model in both actions.

From first action class(after validation), I pass modeldriven model into second class through:

@Result(name = "success", location = "action2", type = "chain")

In second action class, I show values, which has been store into model in first action.

This works fine, but when I execute form submit in second action, stored values from first action are lost.

So, data from first action are stored only for first call second action.

Is there any solution to achieve this?

Was it helpful?

Solution

Put your data into the session or use parameters with a result as described here and there.

Parameters can be passed to results using the params attribute. The value of this attribute is a string array with an even number of elements in the form {"key0", "value0, "key1", "value1" ... "keyN", "valueN"}. For example:

 @Action(value="/different/url",
    results={@Result(name="success", type="httpheader", params={"status", "500", "errorMessage", "Internal Error"})}
  )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top