📄 jobsimpledesctag.java
字号:
package com.t60.oa.web.tag;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.io.*;
import org.apache.commons.beanutils.PropertyUtils;
import java.lang.reflect.*;
public class JobSimpleDescTag extends BodyTagSupport {
private String name;
private String property;
private String length;
public int doStartTag() throws JspException {
Object obj = this.pageContext.findAttribute(name);
if (obj == null) {
return 0;
}
Object value = null;
if(this.property != null) {
try {
value = PropertyUtils.getNestedProperty(obj, this.property);
}
catch (Exception ex) {
}
}
else
value = obj;
if (value == null) {
return 0;
}
javax.servlet.jsp.JspWriter out = this.pageContext.getOut();
String str = (String) value;
// Object pr= this.pageContext.findAttribute(length);
if(this.length==null ||this.length.length()>0)
{
try {
out.print(str);
}
catch (IOException ex2) {
}
return 0;
}
try {
int lg=Integer.parseInt(this.length);
if (str.length() > lg) {
out.print(str.substring(0,lg));
}
else {
out.print(str);
}
}
catch (IOException ex1) {
try {
out.print(str);
}
catch (IOException ex3) {
}
}
return 0;
}
public String getLength() {
return length;
}
public String getName() {
return name;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
public void setName(String name) {
this.name = name;
}
public void setLength(String length) {
this.length = length;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -