Install with Maven
Currently the JJSON artifacts are only available on my own small repository. You can add the stable repository when adding this to your pom.xml
<repositories>
<repository>
<id>grobmeier-stable</id>
<url>http://code.grobmeier.de/mvn/stable</url>
</repository>
</repositories>
Then add the following dependency to your project
<dependency>
<groupId>de.grobmeier.json</groupId>
<artifactId>jjson</artifactId>
<version>0.1.0</version>
</dependency>
Manual Install
Just drop the jar-File(s) into your projects classpath and go for it. At the moment there is no maven repository available online, but this is in the works.
Install the Struts 2 Plugin
Install the JsonResult? class in your struts.xml package:
<result-types>
<result-type name="json" class="de.grobmeier.json.plugins.struts2.JsonResult"/>
</result-types>
<action name="doSomething" class="de.grobmeier.DoSomething">
<result type="json" />
</action>
@JSON
class DoSomething {
@JSON public String myString = "test";
@JSON public String myString2 = "test2";
// GETTER necessary like getMyString()
}
@JSON
class DoSomething {
@JSON public void blub() { return "test"; }
}