?? frontaction.java
字號:
package com.jeecms.core;
import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import com.jeecms.core.entity.Website;
import com.jeecms.core.manager.WebsiteMng;
import com.opensymphony.xwork2.Action;
import com.ponyjava.common.struts2.ContextPvd;
import com.ponyjava.common.struts2.interceptor.DomainNameAware;
public class FrontAction implements Action {
@Override
public String execute() throws Exception {
return SUCCESS;
}
/**
* 獲得站點ID
*
* @return
*/
public Long getWebId() {
return getWeb().getId();
}
/**
* 獲得站點對象
*
* @return
*/
public Website getWeb() {
String domain = (String) contextPvd
.getRequestAttr(DomainNameAware.DOMAIN_NAME);
Website website = websiteMng.getWebsite(domain);
if (website == null) {
// @ TODO 轉(zhuǎn)發(fā)到一個友好的頁面
throw new RuntimeException("不存在與該域名匹配的站點:"
+ ServletActionContext.getRequest().getAttribute(
DomainNameAware.DOMAIN_NAME));
}
return website;
}
/**
* /WEB-INF/user_base/ponyjava_com_www/template
*
* @return
*/
public String getTplBase() {
return getWeb().getTplRoot().toString();
}
/**
* /WEB-INF/user_base/
*
* @return
*/
public String getUserBase() {
return Website.USER_ROOT;
}
protected String pageLink;
protected String pageSuffix;
protected String tplPath;
@Autowired
protected WebsiteMng websiteMng;
@Autowired
protected ContextPvd contextPvd;
public String getTplPath() {
return tplPath;
}
public void setTplPath(String tplPath) {
this.tplPath = tplPath;
}
public String getPageLink() {
return pageLink;
}
public String getPageSuffix() {
return pageSuffix;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -