templatebean.java

来自「OperaMasks是一种基于J2EE的Web开发技术」· Java 代码 · 共 28 行

JAVA
28
字号
package demo;

import org.operamasks.faces.annotation.Action;
import org.operamasks.faces.annotation.ManagedBean;
import org.operamasks.faces.annotation.ManagedBeanScope;
import org.operamasks.faces.annotation.ManagedProperty;

@ManagedBean(name = "templateBean", scope = ManagedBeanScope.SESSION)
public class TemplateBean {
	private static final String TEMPLATE1 = "/template/templates/operamasksMain.xhtml";
	private static final String TEMPLATE2 = "/template/templates/operamasksMain2.xhtml";
	private static final String TEMPLATE3 = "/template/templates/operamasksMain3.xhtml";

	@ManagedProperty
	private String templateURL = TEMPLATE1;

	@Action
	public void changeLayout() {
		if (TEMPLATE1.equals(templateURL)) {
			templateURL = TEMPLATE2;
		} else if (TEMPLATE2.equals(templateURL)) {
			templateURL = TEMPLATE3;
		} else {
			templateURL = TEMPLATE1;
		}
	}
}

⌨️ 快捷键说明

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