📄 displaybusinesstag.java
字号:
package com.szmx.tlms.admin.web.tag;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.lang.StringUtils;
import org.displaytag.tags.el.ExpressionEvaluator;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import com.szmx.framework.util.StringUtil;
import com.szmx.framework.spring.context.ApplicationContextUtil;
import com.szmx.tlms.admin.service.ClientBusinessRelationService;
import com.szmx.tlms.TlmsServiceException;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date: 2006-8-2
* Time: 9:20:04
* To change this template use File | Settings | File Templates.
*/
public class DisplayBusinessTag extends TagSupport {
protected final Log log = LogFactory.getLog(getClass());
private String clientID;
public String getClientID() {
return clientID;
}
public void setClientID(String clientID) {
this.clientID = clientID;
}
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
ExpressionEvaluator eval = new ExpressionEvaluator(this, pageContext);
this.clientID = eval.evalString("clientID", this.clientID);
try {
if (StringUtil.isNull(clientID)) {
out.println("");
}
//display the role name according to the company id
ClientBusinessRelationService service = (ClientBusinessRelationService) ApplicationContextUtil.getBean("clientBusinessRelationService");
if (service != null && StringUtils.isNumeric(this.clientID)) {
List businessList = service.searchSelectedBusiness(Long.valueOf(this.clientID));
if (businessList != null && businessList.size() > 0) {
String businessName = "";
for (int i = 0; i < businessList.size(); i++) {
businessName += ((Object[]) businessList.get(i))[2];
if (businessList.size() - 1 != i) {
businessName += ", ";
}
}
out.println(businessName);
}
}
out.println("");
} catch (TlmsServiceException e) {
log.error("TlmsServiceException", e);
} catch (Exception e) {
log.error("Exception", e);
}
return super.doStartTag();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -