2

I'm trying to forward action result to another action with dynamic parameter. The passed parameter to second action has "" value.

@Result(name = "success", 
    location = "edit_service_subscribers", 
        type = "redirect", 
      params = {"selectedServiceId", "%{serviceId}"}
)

I declared private String serviceId; with getter and setter in first action, and private String selectedServiceId; with getter and setter in second action.

Problem is with filling the value of parameter. But where?

How can I pass value of global variable in action class to redirected parameter?

Roman C
  • 49,761
  • 33
  • 66
  • 176
MakoBuk
  • 622
  • 1
  • 10
  • 19

3 Answers3

3
  1. use RedirectAction to redirect to another Action.
    Redirect result is used to redirect to non-action URLs (like external URLs).

  2. This is not OGNL: instead of

    "%{serviceId}"
    

    use

    "${serviceId}"
    
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
  • There is different problem. I agree, there should be used redirectAction, but my second ACTION "edit_service_subscribers" is launched and parameter "selectedServiceId" is empty. I think that the problem is in first ACTION where I fill value of parameter. Is enaugh to declare global variable and fill the value? – MakoBuk Mar 14 '14 at 20:23
3

I already solved it. I don't know how, but there disappeared GETer... So much time spend for that...

My actual code is:

})
@Results({
    @Result(name = "success", type = "redirectAction",params = {"namespace", "/", "selectedServiceId", "${serviceId}", "actionName", "edit_service_subscribers"})
})

It works fine.

MakoBuk
  • 622
  • 1
  • 10
  • 19
1

Replace your line with this

@Result(name = "success", location = "/department.jsp",
        type="redirect", params={"yourkey", "${passingvalue}"})
Aleksandr M
  • 24,264
  • 12
  • 69
  • 143