⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updateprofileaction.java

📁 jsf example about book manager
💻 JAVA
字号:
package com.mycompany.messages;

/**
 * This class updates a user profile in the Project Billboard
 * application.
 *
 * @author Hans Bergsten, Gefion Software <hans@gefionsoftware.com>
 * @version 1.0
 */
public class UpdateProfileAction {

    private EmployeeRegistryBean empReg;
    private EmployeeBean validUser;
    private String[] projects;
    private String requestMethod;

    public EmployeeRegistryBean getRegistry() {
	return empReg;
    }

    public void setRegistry(EmployeeRegistryBean empReg) {
	this.empReg = empReg;
    }

    public EmployeeBean getValidUser() {
	return validUser;
    }

    public void setValidUser(EmployeeBean validUser) {
	this.validUser = validUser;
    }

    public String[] getProjects() {
	return validUser.getProjects();
    }

    public void setProjects(String[] projects) {
	this.projects = projects;
    }

    public String getRequestMethod() {
	return requestMethod;
    }

    public void setRequestMethod(String requestMethod) {
	this.requestMethod = requestMethod;
    }

    /**
     * Updates the projects property of an authenticated user,
     * represented by the "validUser" session attribute, using
     * the EmployeeRegistryBean. This action is only performed
     * for POST requests.
     */
    public String updateProfile() {
        if ("POST".equals(requestMethod)) {
            if (projects == null) {
                projects = new String[0];
            }
            validUser.setProjects(projects);
	    empReg.saveEmployee(validUser);
        }
        return "success";
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -