📄 intag.java
字号:
package com.laoer.bbscs.web.taglib;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.JspException;
import org.apache.commons.io.FileUtils;
import com.laoer.bbscs.comm.BBSCSUtil;
import org.apache.struts.taglib.TagUtils;
import java.io.File;
import java.io.IOException;
import com.laoer.bbscs.comm.Constant;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
/**
* <p>Title: Tianyi BBS</p>
*
* <p>Description: BBSCS</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: Laoer.com</p>
*
* @author Gong Tianyi
* @version 7.0
*/
public class InTag
extends TagSupport {
private static final Log logger = LogFactory.getLog(InTag.class);
protected String type = "";
public InTag() {
}
public int doStartTag() throws JspException {
return (SKIP_BODY);
}
public int doEndTag() throws JspException {
if (this.getType().equalsIgnoreCase("commend")) {
File commendFile = new File(BBSCSUtil.getIncludePath() + "ForumCover_Commend_0.html");
String commendlist = "";
try {
commendlist = FileUtils.readFileToString(commendFile, Constant.CHARSET);
if (commendlist == null) {
commendlist = "";
}
}
catch (IOException ex) {
logger.error(ex);
commendlist = "";
}
TagUtils.getInstance().write(pageContext, commendlist);
return (SKIP_BODY);
}
if (this.getType().equalsIgnoreCase("choice")) {
File choiceFile = new File(BBSCSUtil.getIncludePath() + "Choice_0.html");
String choice = "";
try {
choice = FileUtils.readFileToString(choiceFile, Constant.CHARSET);
if (choice == null) {
choice = "";
}
}
catch (IOException ex) {
logger.error(ex);
choice = "";
}
TagUtils.getInstance().write(pageContext, choice);
return (SKIP_BODY);
}
if (this.getType().equalsIgnoreCase("userexp")) {
File commendFile = new File(BBSCSUtil.getIncludePath() + "UserExp.html");
String commendlist = "";
try {
commendlist = FileUtils.readFileToString(commendFile, Constant.CHARSET);
if (commendlist == null) {
commendlist = "";
}
}
catch (IOException ex) {
logger.error(ex);
commendlist = "";
}
TagUtils.getInstance().write(pageContext, commendlist);
return (SKIP_BODY);
}
if (this.getType().equalsIgnoreCase("userlit")) {
File commendFile = new File(BBSCSUtil.getIncludePath() + "UserLit.html");
String commendlist = "";
try {
commendlist = FileUtils.readFileToString(commendFile, Constant.CHARSET);
if (commendlist == null) {
commendlist = "";
}
}
catch (IOException ex) {
logger.error(ex);
commendlist = "";
}
TagUtils.getInstance().write(pageContext, commendlist);
return (SKIP_BODY);
}
if (this.getType().equalsIgnoreCase("userknow")) {
File commendFile = new File(BBSCSUtil.getIncludePath() + "UserKnow.html");
String commendlist = "";
try {
commendlist = FileUtils.readFileToString(commendFile, Constant.CHARSET);
if (commendlist == null) {
commendlist = "";
}
}
catch (IOException ex) {
logger.error(ex);
commendlist = "";
}
TagUtils.getInstance().write(pageContext, commendlist);
return (SKIP_BODY);
}
return (SKIP_BODY);
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -