I was trying to use the json plugin that's bundled with struts but I'm
running into a few snags. Firstly, I like using annotations whenever
possible so this is what my struts.xml looks like:
<struts>
<constant name="struts.devMode" value="true" />
<!-- Declare global results in this package -->
<package name="my-default" extends="json-default">
<global-results>
<result name="login"
type="redirect">/authenticate/login-page</result>
<result name="error">/error/error.html</result>
</global-results>
<global-exception-mappings>
<exception-mapping exception="java.lang.Exception"
result="error" />
</global-exception-mappings>
</package>
<!-- Secure results use this package -->
<package name="my-secure" extends="my-default">
<interceptors>
<interceptor name="authenticationInterceptor"
class="interceptors.AuthenticationInterceptor" />
<interceptor-stack name="secureStack">
<interceptor-ref name="authenticationInterceptor" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="secureStack" />
</package>
</struts>
You'll notice that my main package, extends json-default. I did this
because a) I assume json-default extended struts-default and b) Since I
want to use annotations I don't want to have to make a whole package for
the few actions that are going to be serialized.
Then in my action class I have this:
@Result(name="success",type="json")
That way, this is the only class that will serialize.
I'm getting a weird error though when I start up my server:
Caused by: Unable to locate parent package [my-secure] - [unknown location]
my-secure is the name of the other package. If I go back to not using
json-default, and just extend struts-default in my-default, it works.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org