?? pagebaseaction.java
字號(hào):
package com.jeecms.core;
import org.apache.commons.lang.StringUtils;
public abstract class PageBaseAction extends IntegrityAction {
public static final String INDEX = "index";
private void handlePathParams() {
len = pathParams.length;
pathName = pathParams[0];
pageName = pathParams[len - 1];
int lineIndex = pageName.indexOf("_");
if (lineIndex != -1) {
pageRaw = pageName.substring(0, lineIndex);
} else {
pageRaw = pageName;
}
}
@Override
public String execute() throws Exception {
handlePathParams();
beforeAll();
pageName = pathParams[len - 1];
if (len == 1 && pageRaw.equals(INDEX)) {
// 首頁(yè)
sysIndex();
afterChnl();
} else if (len == 1 && StringUtils.isNumeric(pageRaw)) {
// 內(nèi)容
content(null, Long.parseLong(pageRaw));
afterContent();
} else if (len == 1) {
alone(pageName);
afterChnl();
} else if (len == 2 && pageRaw.equals(INDEX)) {
chnlIndex(pathName);
afterChnl();
} else if (len == 2 && StringUtils.isNumeric(pageRaw)) {
content(pathName, Long.parseLong(pageRaw));
afterContent();
} else {
throw new RuntimeException("訪問(wèn)路徑不存在");
}
afterAll();
prepareTplParams();
return SUCCESS;
}
/**
* 系統(tǒng)首頁(yè)
*/
protected abstract void sysIndex();
/**
* 欄目頁(yè)
*/
protected abstract void chnlIndex(String chnlName);
/**
* 內(nèi)容頁(yè)
*/
protected abstract void content(String chnlName, Long id);
/**
* 單頁(yè)
*/
protected abstract void alone(String chnlName);
protected void beforeAll() {
}
protected void afterAll() {
}
protected void afterChnl() {
}
protected void afterContent() {
}
protected void prepareTplParams() {
}
protected String[] pathParams;
protected int len = 0;
protected String pathName;
protected String pageName;
protected String pageRaw;
public void setPathParams(String[] pathParams) {
this.pathParams = pathParams;
}
public void setWholeUrl(String wholeUrl) {
this.wholeUrl = wholeUrl;
}
public void setPageLink(String pageLink) {
this.pageLink = pageLink;
}
public void setPageSuffix(String pageSuffix) {
this.pageSuffix = pageSuffix;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -