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
  • 48,723
  • 33
  • 63
  • 158
MakoBuk
  • 562
  • 1
  • 7
  • 18

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
  • 47,982
  • 25
  • 109
  • 228
  • 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
  • 562
  • 1
  • 7
  • 18
1

Replace your line with this

@Result(name = "success", location = "/department.jsp",
        type="redirect", params={"yourkey", "${passingvalue}"})
Aleksandr M
  • 23,988
  • 12
  • 67
  • 136