I am wondering how I can use the Struts2 wildcard feature to redirect users to another action based on the return value: struts.xml: Action: In some cases, return result SUCCESS or INPUT is valid, but in all other cases I want the exact string that I return be used as the redirect location. If I replace my struts.xml to: Then
Tag: actionresult
How to construct a custom JSON error response using the Struts 2 framework
I am working on creating a web application using Struts 2. I want to send out JSON error response like the below when the request URL is not well formed: I am already using the struts2-json plugin for serializing response objects using JSON. How should I go about sending JSON error responses. I can think of the below way of
Getting Result type in Interceptor
I have Struts 2 actions with different (HTML and JSON ) result types. They use common interceptor. If needed to intercept the request, how to return a result based on given action result type? For example, my Action.ERROR forwards to JSP page. If action is JSON type I want to forward JSON error instead. Answer I have Struts2 actions with