3

I want Struts2 action to return different pages based on action suffix. I think it is possible to create a filter that wraps original request and changes URL the way that URL's with different suffixes will be mapped to different actions.

But this solution looks ugly and I'm curious is there any other way to do this.

Roman C
  • 49,761
  • 33
  • 66
  • 176
ooops
  • 326
  • 2
  • 14
  • 1
    The REST mapper does this. How to do it cleanly depends at what level you want to make the differentiation, whether it's app-wide or just across one or a few actions, etc., ranging from trivial to complex. – Dave Newton May 22 '13 at 16:40
  • I don't understand the down/close vote, please explain. – Dave Newton May 22 '13 at 17:15
  • Thank you Dave, I didn't used REST mapper before and I'll take a look on it. On the other side I am afraid that using it for such unrelevant objective is even worse than writing filter to wrap request :) – ooops May 22 '13 at 18:57
  • I wasn't suggesting you use it, I was suggesting you could see how it implements that functionality. – Dave Newton May 22 '13 at 18:59
  • If I only needed that on few actions, I'd rather did some dirty workaround. But I need it to work application-wide. The same action name and method, but different views depending on action suffix. Thanks for directing me to the REST plugin. – ooops May 22 '13 at 19:13

0 Answers0