?? writetag.java
字號:
package cn.bway.struts.tag;
import javax.servlet.jsp.JspException;
import org.apache.struts.util.RequestUtils;
import org.apache.struts.util.ResponseUtils;
/**
* @author Kson
*
*/
public class WriteTag extends org.apache.struts.taglib.bean.WriteTag {
/**
*
*/
private static final long serialVersionUID = 1L;
public String maxlength = null;
public int doStartTag() throws JspException {
if (ignore) {
if (RequestUtils.lookup(pageContext, name, scope) == null)
return (SKIP_BODY); // Nothing to output
}
Object value = RequestUtils.lookup(pageContext, name, property, scope);
if (value == null)
return (SKIP_BODY); // Nothing to output
String output = null;
if (maxlength != null) {
output = formatValue(value);
int outputLength = new Integer(maxlength).intValue();
int stringLength = output.length();
if (stringLength > outputLength) {
output = output.substring(0, outputLength) + "..";
}
} else {
output = formatValue(value);
}
// Print this property value to our output writer, suitably filtered
if (filter)
ResponseUtils.write(pageContext, ResponseUtils.filter(output));
else
ResponseUtils.write(pageContext, output);
// Continue processing this page
return (SKIP_BODY);
}
public String getMaxlength() {
return maxlength;
}
public void setMaxlength(String maxlength) {
this.maxlength = maxlength;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -