您的位置:首页 > 其它

对天乙社区bbscs8实现的详细分析二十一

2008-07-14 11:35 330 查看
我们选择一幅图片,就触发了previewPic('upload'),它在photoview处显示了图片:
function previewPic(upfilename){ //过滤功能!!!
window.parent.upIframeSize();
var upfile = document.getElementById(upfilename);
if (upfile != "") {
var extname = getExtName(upfile.value);
if(extname != "jpg" && extname != "gif" && extname != "jpeg"){
upfile.value = "";
alert("<s:text name="face.jpggif"/>"); //不是图片
}else{
preViewPic('photoview', null, upfile.value, 0, null, 0, 120);
}
}
}

//图片预览
function preViewPic(picDivName,imgName,fn,iBorder,iBorderColor,iWidth,iHeight){
//var picdiv=document.all(picDivName);
var picdiv = document.getElementById(picDivName);
if(picdiv != null && fn != null && fn!=''){
if(imgName ==null) imgName = "picname";
if(iBorder == null) iBorder=0;
if(iBorderColor == null) iBorderColor="#CCCCCC";
var strw,strh
if(iWidth == null || iWidth == 0) strw = "";
else strw = " width="+iWidth+" ";
if(iHeight == null || iHeight == 0) strh = "";
else strh = " height=" + iHeight + " ";
picdiv.innerHTML="<img name='"+imgName+"' alt='预览状态...' "+strw+strh+" border="+iBorder+
" src='"+fn+"' style='border-color:"+iBorderColor+"'>";
document.focus();
}
}
当我们点击上传头像时,触发了/useFace?action=up~~~~当然不是get,而是post方法了哦~
public String up() {
// System.out.println(this.getUpload());用于测试
// System.out.println(this.getUploadFileName());
if (this.getUpload() == null || StringUtils.isBlank(this.getUploadFileName())) {
this.setAjaxCodeid("1");
this.setAjaxMsg(this.getText("error.userupimg.null"));
return "userFaceUpComponent";
}
if (!BBSCSUtil.isAllowPicFile(this.getUploadFileName()) || this.getUpload().length() == 0
|| this.getUpload().length() > this.getSysConfig().getFaceSize() * 1024) {//大于50K
this.setAjaxCodeid("2");
this.setAjaxMsg(this.getText("error.userupimg.upnotice", new String[] { String.valueOf(this.getSysConfig()
.getFaceSize()) }));
return "userFaceUpComponent";
}
UserInfo ui = this.getUserService().findUserInfoById(this.getUserSession().getId());
if (ui == null) {//用于不存在
this.setAjaxCodeid("3");
this.setAjaxMsg(this.getText("error.userupimg.uperror"));
}
String distFileName = ui.getId() + System.currentTimeMillis() + "."
+ FilenameUtils.getExtension(this.getUploadFileName());
try {
this.getUserService().createUserFacePic(ui, distFileName, new FileInputStream(this.getUpload()));//注意this.getUpload...
/**
private File upload;
public File getUpload() {
return upload;
}
public void setUpload(File upload) {
this.upload = upload;
}
*/
this.setAjaxCodeid("0");
this.setAjaxMsg(this.getText("userupimg.up.ok"));
} catch (FileNotFoundException ex) {
this.setAjaxCodeid("3");
this.setAjaxMsg(this.getText("error.userupimg.uperror"));
} catch (BbscsException ex) {
this.setAjaxCodeid("4");
this.setAjaxMsg(this.getText("error.userupimg.uperror"));
}
return "userFaceUpComponent";
}
我们看我们在iframe中的提交为什么能更新上面框架的内容,我们看userFaceUpComponent:
<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>
<script language="JavaScript" type="text/javascript">
window.parent.OnUploadCompleted("<s:property value="%{ajaxCodeid}"/>","<s:property value="%{ajaxMsg}"/>");
</script>
哦,这里触发了上层的js:
function OnUploadCompleted(codeid,msg){
var objif = document.getElementById('upfileIframe');
objif.height = 120;
objif.src= getActionMappingURL("/userFace?action=uppage"); //还原为原来的样子!
if (codeid == "0") {
//alert(msg);
userFaceShow();
}
if (codeid == "1") {
alert(msg); //提示错误信息
}
if (codeid == "2") {
alert(msg);
}
if (codeid == "3") {
alert(msg);
}
if (codeid == "4") {
alert(msg);
}
}
function userFaceShow() { //显示出来!
$('userFaceDiv').innerHTML = pageLoadingCenter;
var userId = "<s:property value="%{userSession.id}"/>";
var urls = getActionMappingURL("/userFace");
var pars = "action=showface&ajax=shtml&userId=" + userId;
var myAjax = new Ajax.Updater("userFaceDiv", urls, {method: 'get', parameters: pars});
}
-->
public String showface() {
this.setUserId(this.getUserSession().getId());
return "showface";
}
看下showFace.jsp:
<%
request.setAttribute("decorator", "none");
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<bbscs:face value="%{userId}"/>
对于删除功能我们不再加以分析!
我们看userDetailSet.bbscs?action=index:
<action name="userDetailSet" class="userDetailSetAction">
<interceptor-ref name="mainUserAuthInterceptorStack"></interceptor-ref>
<interceptor-ref name="remoteAddrInterceptor"></interceptor-ref>
<result name="input">/WEB-INF/jsp/userDetailSet.jsp</result>//注意这里是input
</action>
十分简单哦我们看index方法中关键的代码:
UserInfo ui = this.getUserService().findUserInfoById(this.getUserSession().getId());
if (ui == null) {
this.addActionError(this.getText("error.user.noexist"));
return ERROR;
}
setRadioSexListValues();
/**
List<RadioInt> radioSexList = new ArrayList<RadioInt>();

private void setRadioSexListValues() {
radioSexList.add(new RadioInt(1, this.getText("bbscs.man")));
radioSexList.add(new RadioInt(2, this.getText("bbscs.woman")));
}
*/
this.setAction("edit");//action!
this.setBirthDay(ui.getBirthDay());
this.setBirthMonth(ui.getBirthMonth());
this.setBirthYear(String.valueOf(ui.getBirthYear()));
另外,值得注意的是这个action类中还有一些yearValues,monthValues,dayValues:
private List<OptionsString> yearValues = Constant.YEARS;
private List<OptionsInt> monthValues = Constant.MONTH;
private List<OptionsInt> dayValues = Constant.DAY;
-->
public static List<OptionsString> YEARS = new ArrayList<OptionsString>();//OptionString!
public static List<OptionsInt> MONTH = new ArrayList<OptionsInt>();
public static List<OptionsInt> DAY = new ArrayList<OptionsInt>();
我们看userDetailSet.jsp:
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<s:actionerror theme="bbscs0"/>
</td>
</tr>
<tr>
<td>
<s:actionmessage theme="bbscs0"/> //显示数据更新成功的提示!
</td>
</tr>
</table>
我们在template.bbscs0中找到actionmessage.ftl:
<#if (actionMessages?exists && actionMessages?size > 0)>
<div class="msg3">
<#list actionMessages as message>
<span class="actionMessage">${message}</span><br/>
</#list>
</div>
</#if>

<td class="bgColor2">
<s:select list="yearValues" name="birthYear" id="birthYear" cssClass="select1" listKey="key" listValue="value"></s:select>
<s:text name="bbscs.year"/>
<s:select list="monthValues" name="birthMonth" id="birthMonth" cssClass="select1" listKey="key" listValue="value"></s:select>
<s:text name="bbscs.mon"/>
<s:select list="dayValues" name="birthDay" id="birthDay" cssClass="select1" listKey="key" listValue="value"></s:select>
<s:text name="bbscs.day"/>
</td>
对应年月日的显示!注意这个页面的修改提交没用ajax!
好,我们看最后一个个人中心的设置了:boardSaveManage.bbscs
<action name="boardSaveManage" class="boardSaveManageAction">
<interceptor-ref name="mainUserAuthInterceptorStack"></interceptor-ref>
<result name="success">/WEB-INF/jsp/boardSaveManage.jsp</result>
<result name="list" type="redirect-action">boardSaveManage?action=index</result>
</action>
进入index方法中:
public String index() {
this.setAction("dels");
List bslist = this.getBoardSaveService().findBoardSavesByUid(this.getUserSession().getId());
this.setBoardList(this.getBoardService().findBoardsInIDs(this.getBoardIds(bslist)));
return SUCCESS;
}
==>private List getBoardIds(List bslist) {
List<Long> blist = new ArrayList<Long>();
for (int i = 0; i < bslist.size(); i++) {
BoardSave bs = (BoardSave) bslist.get(i);
blist.add(new Long(bs.getBoardID()));//将BoardID写入到blist中!
}
return blist;
}
而boardSaveManage.jsp遍历结果加以显示出来!
<td valign="middle" class="bgColor4">
<div align="center">
<input type="checkbox" name="ids" value="<s:property value="#b.id"/>"/>
</div>
</td>
<td colspan="4" class="bgColor4">
<s:submit cssClass="button1" value="%{getText('bbscs.del')}"></s:submit>
</td>
这个是删除功能:/boardSaveManage?action=dels:
public String dels() {
if (this.getIds() == null || this.getIds().isEmpty()) {
this.addActionError(this.getText("error.parametererror"));
return ERROR;
}
try {
this.getBoardSaveService().removeBoardSaveByBidsUid(this.getUserSession().getId(), this.getIds());
return "list";
} catch (BbscsException e) {
logger.error(e);
this.addActionError(this.getText("error.boardsave.del"));
return ERROR;
}
}
OK!十分简单!我们看logout.bbscs先!
<action name="logout" class="logoutAction">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="userLoginInterceptor"></interceptor-ref>
<interceptor-ref name="userSessionInterceptor"></interceptor-ref>
<interceptor-ref name="requestBasePathInterceptor"></interceptor-ref>
<result name="success" type="redirect">${logoutUrl}</result>
</action>
它是在main package中的,但它继承了BaseAction,实现了UserSessionAware, RequestBasePathAware, SessionAware,好我们看其execute方法:
public String execute() {
UserOnline uo = this.getUserOnlineService().findUserOnlineByUserID(userSession.getId());
if (uo != null) {
try {
this.getUserOnlineService().removeUserOnline(uo);
} catch (BbscsException e) {
logger.error(e);
}
}
this.getSession().remove(Constant.USER_SESSION_KEY);
userCookie.removeAllCookies();

if (StringUtils.isNotBlank(this.getAction()) && this.getAction().equalsIgnoreCase("pass")) {
userCookie.removePassCookies();
}

if (StringUtils.isBlank(this.getSysConfig().getLogoutUrl())
|| this.getSysConfig().getLogoutUrl().startsWith("/")) {
String url = this.getSysConfig().getLogoutUrl().substring(1, this.getSysConfig().getLogoutUrl().length());
url = BBSCSUtil.getActionMappingURLWithoutPrefix(url);

this.setLogoutUrl(this.basePath + url);//logout url!
} else {
this.setLogoutUrl(this.getSysConfig().getLogoutUrl());
}
return SUCCESS;
}
在首页中,我们先分析在线online.bbscs?action=user及online.bbscs?action=friend:
<action name="online" class="onlineAction">
<interceptor-ref name="mainUserAuthInterceptorStack"></interceptor-ref>
<result name="success">/WEB-INF/jsp/onlineList.jsp</result>
</action>
在Online.java中:
public String user() {
long atime = this.getTime();
/**
private long getTime() {
return System.currentTimeMillis() - (this.getSysConfig().getUserOnlineTime() * 1000);
}
*/
this.setOnlineList(this.getUserOnlineService().findUserOnlines(atime, 0, 0, Constant.NORMAL_USER_GROUPS));//普通用户组"from UserOnline where onlineTime >= ?";
/**Criteria c = s.createCriteria(UserOnline.class);
c.add(Restrictions.ge("onlineTime", new Long(atime)));
if (boardID != 0) {
c.add(Restrictions.eq("boardID", new Long(boardID)));
}
if (hiddenUser != -1) {
c.add(Restrictions.eq("hiddenUser", new Integer(hiddenUser)));
}
if (groups != null && !groups.isEmpty()) {
c.add(Restrictions.in("userGroupID", groups));
}
return c.list();
*/
return SUCCESS;
}
另外一个:action=friend
public String friend() {
long atime = this.getTime();
this.setOnlineList(this.getUserOnlineService().findUserOnlinesInIds(atime,
this.getFriendService().fileToFriendIDs(this.getUserSession().getId()), 0, 0,
Constant.NORMAL_USER_GROUPS));
/**
public List fileToFriendIDs(String ownId) {
List<String> l = new ArrayList<String>();
File fromFile = new File(this.getUserConfig().getUserFilePath(ownId) + Constant.USER_FRIEND_FILE);//public static final String USER_FRIEND_FILE = "UserFriendFile.txt";
try {
String fids = FileUtils.readFileToString(fromFile, Constant.CHARSET);
String[] ids = fids.split(",");
if (ids != null) {
for (int i = 0; i < ids.length; i++) {
//System.out.println(ids[i]);
l.add(ids[i]);
}
}
} catch (IOException e) {
logger.error(e);
}
return l;
}
*/
return SUCCESS;
}
OK!对于用户信息的显示也有两类:我们先看URL:http://bbs.laoer.com/userInfo.bbscs?action=name&username=laoer以及http://bbs.laoer.com/userInfo.bbscs?action=id&id=4028818208ed006b0108ed020bd50001
进入userInfo:
<action name="userInfo" class="userInfoAction">
<interceptor-ref name="mainUserAuthInterceptorStack"></interceptor-ref>
<result name="success">/WEB-INF/jsp/showUserInfo.jsp</result>
<result name="bookMarkInUserInfo">/WEB-INF/jsp/bookMarkInUserInfo.jsp</result>
</action>
我们直接看代码:
public String name() {
this.ui = this.getUserService().findUserInfoByUserName(this.getUsername());
if (this.ui == null) {
this.addActionError(this.getText("error.user.noexist"));
return ERROR;
}

this.setUserDetail(ui.getUserDetail());

Pages pages = new Pages();
pages.setPage(1);
pages.setPerPageNum(10);
pages.setTotalNum(10);

PageList pl = this.getForumService().findForumsOwner(ui.getId(), 1, pages);//isNew=1代表主贴
this.setOwnMainList(pl.getObjectList());

pages = new Pages();
pages.setPage(1);
pages.setPerPageNum(10);
pages.setTotalNum(10);

pl = this.getForumService().findForumsOwner(ui.getId(), 0, pages);//0代表回复
this.setOwnReList(pl.getObjectList());

return SUCCESS;
}
id方法类似,注意其中的一段:
ui.getUserDetail().setBrief(BBSCSUtil.filterText(ui.getUserDetail().getBrief(), false, false, true));
另外,有个bookMark方法,它是用于找到用户的共享bookMark!
public String bookmark() {
Pages pages = new Pages();
pages.setPage(this.getPage());
pages.setPerPageNum(10);
pages.setFileName(BBSCSUtil.getActionMappingURLWithoutPrefix("userInfo?action=" + this.getAction() + "&id="
+ this.getId() + "&ajax=shtml"));
this.setPageList(this.getBookMarkService().findBookMarksByUserIDShare(this.getId(), 1, pages));//PageList设置了哦~~
return "bookMarkInUserInfo";
}
我们先看bookMarkInUserInfo.jsp:
<s:iterator value="%{pageList.objectList}" id="bookMark">

<tr>
<td class="bgColor4">
<span class="font1">
<a href="<s:property value="#bookMark.url"/>" title="<s:property value="#bookMark.alt"/>" target="_blank"><s:property value="#bookMark.bookMarkName"/></a>
</span>
</td>
</tr>
</s:iterator>
<tr>
<td class="bgColor3"><s:text name="bbscs.pagebreak"/>:<bbscs:pages value="%{pageList.pages}" javaScript="loadBookMarkListPageUrl"/></td>
</tr>
-->
function loadBookMarkListPageUrl(url) { //注意这个函数是在showUserInfo.jsp中的
$('bookMarkListDiv').innerHTML = pageLoadingCenter;
var urls = getActionName(url);
var pars = getActionPars(url);
var myAjax = new Ajax.Updater("bookMarkListDiv", urls, {method: 'get', parameters: pars});
}
好,我们进而分析showUserInfo.jsp它的body onload="loadBookMarkListPage();"
var userid = "<s:property value="%{ui.id}"/>";
function loadBookMarkListPage() {
$('bookMarkListDiv').innerHTML = pageLoadingCenter;
var urls = getActionMappingURL("/userInfo");
var pars = "action=bookmark&ajax=shtml&id="+userid;
var myAjax = new Ajax.Updater("bookMarkListDiv", urls, {method: 'get', parameters: pars});
}
我们注意到,在用户信息页面上还有一个给该用户留言功能,这个功能点击后将显示一个div,它与前面的note类似!因此这个文件<script type="text/javascript" src="js/note.js"></script>还有<div id="noteSendDiv"></div>用户提供界面的显示哦~
OK!我们将分析下关键的forum-index-15.index(或froum?action=index&bid=15),我们还是从struts.xml文件中看起吧。在struts.xml中,专门定义了用于整个forum package!
<package name="forum" extends="bbscs-default" namespace="/">
<default-interceptor-ref name="boardInterceptorStack"></default-interceptor-ref>
<action name="forum" class="forumAction">
<interceptor-ref name="boardInterceptorStack"></interceptor-ref>
<interceptor-ref name="requestBasePathInterceptor"></interceptor-ref>
<result name="forumBoard">/WEB-INF/jsp/forumBoard.jsp</result>
<result name="forum">/WEB-INF/jsp/forum.jsp</result>
<result name="forumHistory">/WEB-INF/jsp/forumHistory.jsp</result>
</action>
....
我们先看boardInterceptorStack:
<interceptor-stack name="boardInterceptorStack">
<interceptor-ref name="defaultStack"></interceptor-ref>
<interceptor-ref name="userLoginInterceptor"></interceptor-ref>
<interceptor-ref name="userOnlineInterceptor"></interceptor-ref>
<interceptor-ref name="boardInterceptor"></interceptor-ref>
</interceptor-stack>
注意到它没有了userSessionInterceptor以及userPermissionInterceptor这两个权限检查的功能了!而增加了一个boardInterceptor,我们可以到com.laoer.bbscs.web.interceptor中找到这个拦截器,这个拦截器在进入版区之前就会进行调用,首先根据action提供的ajax,action,bid等值进入判断参数是否充分!如bid==0是不正确的,还有就是根据bid找到版区,没有的话,也报错!我们可在url分别输入http://bbs.laoer.com/forum.bbscs?action=index&bid=100&ajax=shtml 没有格式输出
http://bbs.laoer.com/forum.bbscs?action=index&bid=100&ajax=html 有html格式
http://bbs.laoer.com/forum.bbscs?action=index&bid=100 //用默认的String ajax = "html";
进行对比,就知道显示效果了!
if (action instanceof BoardAware) {
((BoardAware) action).setBoard(board);

}
接下来:
if (us.getBid() != bid) {
us.getBoardPermission().clear();
us.getBoardSpecialPermission().clear();

us.setBid(bid); //将bid写入us
us.setBoardPass("");
Map[] maps = boardService.getBoardPermission(bid, us.getGroupID()); // 取得版区用户组权限

us.setBoardPermissionArray(maps);//写入权限!

BoardMaster bm = (BoardMaster) board.getBoardMaster().get(us.getUserName());
if (bm != null) {// 是斑竹
Map[] bmpMap = boardService.getBoardMasterPermission(bm.getRoleID()); // 取得斑竹权限
us.setBoardPermissionArray(bmpMap);
}

for (int i = 0; i < board.getParentIDs().size(); i++) {
Board pboard = boardService.getBoardByID(((Long) (board.getParentIDs().get(i))).longValue());
BoardMaster pbm = (BoardMaster) pboard.getBoardMaster().get(us.getUserName());//上级的权限!
if (pbm != null && pbm.getOverChildPurview() == 1) {
Map[] bmpMap = boardService.getBoardMasterPermission(pbm.getRoleID()); // 取得斑竹权限
us.setBoardPermissionArray(bmpMap);
}
}
ac.getSession().put(Constant.USER_SESSION_KEY, us);
UserOnlineService userOnlineService = (UserOnlineService) wc.getBean("userOnlineService");

UserOnline uo = userOnlineService.findUserOnlineByUserID(us.getId()); // 取得用户在线信息
if (uo != null) {
uo.setAtPlace(board.getBoardName());
uo.setBoardID(bid);
try {
userOnlineService.saveUserOnline(uo);
} catch (BbscsException ex) {
logger.error(ex);
}
}

}
if (board.getNeedPasswd() == 1 && StringUtils.isNotBlank(board.getPasswd())) {// 版区需要密码访问
if (!us.isHaveBoardSpecialPermission(Constant.SPERMISSION_INBOARD_NOT_NEEDPASSWD)) {
if (StringUtils.isBlank(us.getBoardPass())) {
return "boardPasswd";
} else if (!(bid + ":" + board.getPasswd()).equals(us.getBoardPass())) {//访问密码不对的话!
// 版区需要密码,需要跳转
((ActionSupport) action).addActionError(messageSource.getMessage("error.board.passwd", null, ac
.getLocale()));
return "boardPasswd";
}
}
}
这里有个<result name="boardPasswd">/WEB-INF/jsp/boardPasswd.jsp</result>
<s:form action="boardPasswd">
<s:hidden name="action" value="pass"></s:hidden>
<s:hidden name="bid" value="%{bid}"></s:hidden>
....
注意到struts.xml中boardPasswd是个special package中的一个action:
<package name="special" extends="bbscs-default" namespace="/">
<action name="boardPasswd" class="boardPasswdAction">
<interceptor-ref name="userSessionInterceptorStack"></interceptor-ref>
<interceptor-ref name="requestBasePathInterceptor"></interceptor-ref>
<result name="success" type="redirect">${forwardUrl}</result>
</action>
</package>
我们看boardPasswd这个action中的pass方法:
public String pass() {
if (StringUtils.isBlank(this.getPasswd())) {
this.addActionError(this.getText("error.nullerror"));
return "boardPasswd";
}
this.getUserSession().setBoardPass(this.getBid() + ":" + this.getPasswd());
this.setForwardUrl(this.getBasePath()
+ BBSCSUtil.getActionMappingURLWithoutPrefix("forum?action=index&bid=" + this.getBid()));
return SUCCESS;
}
回过头来!
if (board.getIsAuth() == 1) {// 版区需要授权访问
BoardMaster bm = (BoardMaster) board.getBoardMaster().get(us.getUserName());
if (bm == null && !us.isHaveBoardSpecialPermission(Constant.SPERMISSION_INBOARD_NOT_NEEDAUTH)) { // 不是斑竹,并且没有不需要授权就可以进入的权限
// 版区需要授权
BoardAuthUserService boardAuthUserService = (BoardAuthUserService) wc
.getBean("boardAuthUserService");
if (boardAuthUserService.findBoardAuthUserByBidUid(bid, us.getId()) == null) {
// 不是授权用户,需要跳转
String errorMsg = messageSource.getMessage("error.user.not.auth", null, ac.getLocale());
if (ajax.equalsIgnoreCase("html")) {
ac.getValueStack().set("interceptError", errorMsg);
return "intercepthtml";
} else if (ajax.equalsIgnoreCase("shtml")) {
ac.getValueStack().set("interceptError", errorMsg);
return "interceptshtml";
} else {
AjaxMessagesJson ajaxMessagesJson = (AjaxMessagesJson) wc.getBean("ajaxMessagesJson");
ajaxMessagesJson.setMessage("E_BOARDID_AUTH", errorMsg);
ac.getValueStack().set("ajaxMessagesJson", ajaxMessagesJson);
return "ajaxjson";
}
}
}
}

boolean havePermission = false;
Permission permission = (Permission) us.getBoardPermission().get(actionName + "?action=*");//具体地权限对比一下!
if (permission != null) {
havePermission = true;
} else {
permission = (Permission) us.getBoardPermission().get(actionName + "?action=" + saction);
if (permission != null) {
havePermission = true;
} else {
havePermission = false;
}
}
if (havePermission) {
if (action instanceof BoardAware) {
((BoardAware) action).setUserCookie(userCookie);
((BoardAware) action).setUserSession(us);
}
return invocation.invoke();
最后我们来看看BoardAware:
public interface BoardAware {
public void setBoard(Board board);
public void setUserCookie(UserCookie userCookie);
public void setUserSession(UserSession userSession);//其实也和session cookie有关系了!
}
好,我们看forum.bbscs,注意它是从BaseBoardAction继承过来的,也实现了RequestBasePathAware方法,我们先看BaseBoardAction:public class BaseBoardAction extends BaseAction implements BoardAware,也要注意到它有以下属性和execute方法(这个和BaseMainAction一样):
private Board board;
private UserCookie userCookie;
private UserSession userSession;
private long bid = 0;
private String tagId = "0";
public String execute() {
try {
return this.executeMethod(this.getAction());
} catch (Exception e) {
logger.error(e);
return ERROR;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: