<%@ page contentType="text/html;charset=UTF-8" language="java" %> AJAX and JSON Guide
Guide

Returning JSON from Struts2 actions

The demo now includes both an action-level JSON response and a REST-style JSON route. That makes it easier to compare MVC pages with lightweight API payloads.

What the action returns

public class AjaxAction extends ActionSupport {
    private boolean success;
    private String message;
    private List<User> users;

    public String execute() {
        success = true;
        message = "Mock AJAX response";
        return SUCCESS;
    }
}