package action; import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.ActionSupport; import org.apache.struts2.ServletActionContext; import java.awt.*; public class ColorChangeAction extends ActionSupport { private Color color=new Color(255, 255, 255); private String colorcode; public Color getColor() { return color; } public String getColorcode() { return "#"+Integer.toHexString(color.getRed())+Integer.toHexString(color.getGreen())+Integer.toHexString(color.getBlue()); } @Override public String execute() throws Exception { ServletActionContext.getRequest().setAttribute("code",getColorcode()); return SUCCESS; } public void setColor(Color color) { this.color = color; } }
最近下载更多