日期:2014-05-17  浏览次数:20699 次

动态生成html页面(一)
需求:根据如下三个Model类,动态生成html页面,让用户设置参数,并且要取得数据存数据库。

public class Policy implements Serializable
{
    
    // 
    private static final long serialVersionUID = -3934515492869305972L;
    
    private String name;
    
    private String level;
    
    private String display;
    
    private List<PolicyParam> params;
    
    public String getName()
    {
        return name;
    }
    
    public void setName(String name)
    {
        this.name = name;
    }
    
    public String getLevel()
    {
        return level;
    }
    
    public void setLevel(String level)
    {
        this.level = level;
    }
    
    public String getDisplay()
    {
        return display;
    }
    
    public void setDisplay(String display)
    {
        this.display = display;
    }

    public List<PolicyParam> getParams()
    {
        return params;
    }

    public void setParams(List<PolicyParam> params)
    {
        this.params = params;
    }
    
}


public class PolicyParam implements Serializable
{

    // 
    private static final long serialVersionUID = 1L;
    
    private String name;
    
    private String policyName;
    
    private String valueRange;
    
    private String display;
    
    private String type;
    
    private String tips;
    
    private List<Unit> units;

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getPolicyName()
    {
        return policyName;
    }

    public void setPolicyName(String policyName)
    {
        this.policyName = policyName;
    }

    public String getValueRange()
    {
        return valueRange;
    }

    public void setValueRange(String valueRange)
    {
        this.valueRange = valueRange;
    }

    public String getType()
    {
        return type;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public String getDisplay()
    {
        return display;
    }

    public void setDisplay(String display)
    {
        this.display = display;
    }

    public String getTips()
    {
        return tips;
    }

    public void setTips(String tips)
    {
        this.tips = tips;
    }

    public List<Unit> getUnits()
    {
        return units;
    }

    public void setUnits(List<Unit> units)
    {
        this.units = units;
    }
    
}


public class Unit implements Serializable
{

    // 
    private static final long serialVersionUID = 1L;
    
    private String name;
    
    private String policyName;
    
    private String paramName;
    
    private String display;

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getPolicyName()
    {
        return policyName;
    }

    public void setPolicyName(String policyName)
    {
        this.policyName = policyName;
    }

    public String getParamName()
    {
        return paramName;
    }

    public void setParamName(String paramName)
    {
        this.paramName = paramName;
    }

    public String getDisplay()
    {
        return display;
    }

    public void setDisplay(String display)
    {
        this.display = display;
    }
    
}