javajsonstruts2struts2-convention-plugin

Param attribute usage in @Result Annotation


How to specify the variables to be converted to JSON in @Result Annotation?

Now it is converting all variables with getters to JSON String.

How to use params attribute in @Result?

@Action(value = "save", results = { @Result(name = "success", type = "json") })

Solution

  • I think this should work:

    @Result(type = "json", params = {
                "includeProperties",
                "var1,var2"
            })