49 lines
1.3 KiB
Java
49 lines
1.3 KiB
Java
package com.demo.action;
|
|
|
|
import com.demo.model.User;
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
public class AjaxAction extends ActionSupport {
|
|
|
|
private static final DateTimeFormatter TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
private boolean success;
|
|
private String message;
|
|
private String serverTime;
|
|
private List<User> users;
|
|
|
|
@Override
|
|
public String execute() {
|
|
success = true;
|
|
message = "Mock AJAX response generated from the Struts2 action.";
|
|
serverTime = LocalDateTime.now().format(TIME_FORMATTER);
|
|
users = Arrays.asList(
|
|
new User(1L, "ops-admin", "ops-admin@example.com", "13800000001"),
|
|
new User(2L, "platform-owner", "platform-owner@example.com", "13800000002"),
|
|
new User(3L, "release-manager", "release-manager@example.com", "13800000003")
|
|
);
|
|
return SUCCESS;
|
|
}
|
|
|
|
public boolean isSuccess() {
|
|
return success;
|
|
}
|
|
|
|
public String getMessage() {
|
|
return message;
|
|
}
|
|
|
|
public String getServerTime() {
|
|
return serverTime;
|
|
}
|
|
|
|
public List<User> getUsers() {
|
|
return users;
|
|
}
|
|
}
|