displaycontractstate.java

来自「一个关于tlms的一个小程序 看看能否帮助到别人」· Java 代码 · 共 64 行

JAVA
64
字号
package com.szmx.tlms.contractManage.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.RelationInfoService;
import com.szmx.tlms.admin.model.RelationInfo;
import com.szmx.tlms.TlmsServiceException;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2006-8-21
 * Time: 13:49:00
 * To change this template use File | Settings | File Templates.
 */
public class DisplayContractState extends TagSupport {
    protected final Log log = LogFactory.getLog(getClass());
    private String ContractStateID;

    public String getContractStateID() {
        return ContractStateID;
    }

    public void setContractStateID(String ContractStateID) {
        this.ContractStateID = ContractStateID;
    }

    public int doStartTag() throws JspException {
        JspWriter out = pageContext.getOut();
        ExpressionEvaluator eval = new ExpressionEvaluator(this, pageContext);
        this.ContractStateID = eval.evalString("ContractStateID", this.ContractStateID);

        try {
            if (StringUtil.isNull(ContractStateID)) {
                out.println("");
            }
            //display the role name according to the company id
            RelationInfoService service = (RelationInfoService) ApplicationContextUtil.getBean("relationInfoService");
            if (service != null && StringUtils.isNumeric(this.ContractStateID)) {
                RelationInfo relationInfo = service.getRelationInfo(Long.valueOf(this.ContractStateID));
                String name = relationInfo.getName();
                out.println(name);
            } else {
                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 + =
减小字号Ctrl + -
显示快捷键?