JSF1.2当通过h:commandButton调用bean方法时,它并不总是有效

JSF1.2当通过h:commandButton调用bean方法时,它并不总是有效,jsf,backing-beans,Jsf,Backing Beans,最近,我遇到了一个非常奇怪的问题。详情如下: 在典型CRUD工作流的save页面中,单击h:commandButton调用backingend bean中的save方法并不总是有效。有时,完成我在bean中指导的方法后,它会像我预期的那样工作。在其他情况下,它只是创建新Bean而没有进入更新模式阶段,不用说它进入Bean方法。控制台中没有显示错误消息,只有一些可疑语句,如:[component]没有组件j_id26的渲染器类型,等等 我试图通过为所有JSFHTML标记分配一个id来解决这个问题。

最近,我遇到了一个非常奇怪的问题。详情如下: 在典型CRUD工作流的save页面中,单击h:commandButton调用backingend bean中的save方法并不总是有效。有时,完成我在bean中指导的方法后,它会像我预期的那样工作。在其他情况下,它只是创建新Bean而没有进入更新模式阶段,不用说它进入Bean方法。控制台中没有显示错误消息,只有一些可疑语句,如:[component]没有组件j_id26的渲染器类型,等等

我试图通过为所有JSFHTML标记分配一个id来解决这个问题。然而,这看起来是徒劳的。即使是我也不能以固定的方式复制。太随机,无法掌握基本的误差原理

因为页面源代码有点大。让我确认一下你们是否有类似的问题,然后我会进一步提供更多的线索

提前谢谢

守则如下: 1.graphtemplate.xhtml

........
    <table>
        <tr>
            <td id="tdBtnSave"><h:commandButton id="invisibleBtnSave"
                action="#{graphTemplate.save}" style="display: none">
            </h:commandButton>
            <button type="button" dojoType="dijit.form.Button" id="step5Save">SAVE</button>
            </td>
            <td>
            <button type="button" dojoType="dijit.form.Button" id="step5Cancel">CANCEL</button>
            </td>
        </tr>
    </table>
    <p />
。。。。。。。。
拯救
取消

2.GraphTemplateBean.java

/**
* 
* @author Freeman Bo Ye
* 
*/
public class GraphTemplateBean extends ThinBeanBase {

public Integer id = null;
public Integer getId() {
    return id;
}

public void setId(Integer id) {
    this.id = id;
}

/*
 * y, x axis data (step 1)
 */
private List<String> yAxes = new ArrayList<String>(); // y axes
private Integer yScaleType = null; // y axis scale type
private Boolean yScaleIsAuto = null; // y axis scale is auto
private Double yCustomNumStart = null; // y custom start
private Double yCustomNumEnd = null; // y custom end
private Double yCustomNumTicMarks = null; // y custom tic marks
private String xAxis = null; // x axis
private Integer xScaleType = null; // x axis scale type
private Boolean xScaleIsAuto = null; // x axis scale is auto
private Date xCustomDateStart = null; // x axis custom date start
private Double xCustomNumStart = null; // x axis custom number start
private Date xCustomDateEnd = null; // x axis custom date end
private Double xCustomNumEnd = null; // x axis custom number end
private Integer xCustomDateTicMarks = null; // x custom date tic marks
private Double xCustomNumTicMarks = null; // x custom number tic marks
/*
 * graph titles (step 2)
 */
private List<String> graphTitles = new ArrayList<String>(); // graph titles
private String graphCustomTitle = null; // graph custom title
private Integer graphTitleFontSize = null; // graph title font size
private Color graphTitleColor = null; // graph title color
private List<Integer> graphTitleStyles = new ArrayList<Integer>(); // graph title styles
private Boolean isMultiLines = null; // is multiple lines
private String yTitle = null; // y title
private String yCustomTitle = null; // y custom title
private Integer yTitleFontSize = null; // y title font size
private Color yTitleColor = null; // y title color
private List<Integer> yTitleStyles = new ArrayList<Integer>(); // y title styles
private String xTitle = null; // x title
private String xCustomTitle = null; // x custom title
private Integer xTitleFontSize = null; // x title font size
private Color xTitleColor = null; // x title color
private List<Integer> xTitleStyles = new ArrayList<Integer>(); // x title styles
/*
 * line styles (step 3)
 */
private List<LineStyle> lineStyles = new ArrayList<LineStyle>(); // line styles
/*
 * define legend (step 4)
 */
private Boolean isShowUserLegend = null;
private List<String> legendTitles = new ArrayList<String>();
private Integer userLegendFontSize = null;
private Color userLegendColor = null;
private List<Integer> userLegendStyles = new ArrayList<Integer>();

private Boolean isShowDataLegend = null;
private Integer dataLegendFontSize = null;
private Color dataLegendColor = null;
private List<Integer> dataLegendStyles = new ArrayList<Integer>();
/*
 * name and extra properties (step 5)
 */
private String name = null; // graph template name

private List<Integer> extraProps = new ArrayList<Integer>(); // graph template's extra properties

public GraphTemplateBean() {
    logger.debug("new graph template bean request......");
    for (SelectItem selectItem : getAllYAxes()) {
        LineStyle lineStyle = new LineStyle();
        lineStyle.setyAxis(selectItem.getLabel());
        lineStyles.add(lineStyle);
    }
    logger.info("GraphTemplateBean is created.");
}

..............

/**
 * Get creating type from scratch or saved graph template.
 * 
 * @return from scratch or saved
 */
public List<SelectItem> getFromScratchOrSaved() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem(true, "Create new graph from scratch"));
    result.add(new SelectItem(false, "Start with saved graph:"));
    return result;
}

/**
 * All graph templates
 * 
 * @return all graph templates
 * @throws GraphServiceException
 */
public List<SelectItem> getAllGraphTemplates() throws GraphServiceException {
    List<SelectItem> result = new ArrayList<SelectItem>();
    GraphService gs = GraphServiceFactory.getInstance(getUser());
    List<MyTemplate> graphTemplates = gs.listMyTemplate();
    for (MyTemplate graphTemplate : graphTemplates) {
        result.add(new SelectItem(graphTemplate.getId(), graphTemplate.getName()));
    }
    return result;
}

/**
 * all y axes.
 * 
 * @return all y axes
 */
public List<SelectItem> getAllYAxes() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem("Oil (bbl)", "Oil (bbl)"));
    result.add(new SelectItem("Gas (mcf)", "Gas (mcf)"));
    result.add(new SelectItem("Water (bbl)", "Water (bbl)"));
    result.add(new SelectItem("Injection", "Injection"));
    result.add(new SelectItem("Historical Well Count", "Historical Well Count"));
    result.add(new SelectItem("Cumulative Oil (bbl)", "Cumulative Oil (bbl)"));
    result.add(new SelectItem("Cumulative Gas (mcf)", "Cumulative Gas (mcf)"));
    result.add(new SelectItem("Cumulative Water (bbl)", "Cumulative Water (bbl)"));
    result.add(new SelectItem("Cumulative Injection", "Cumulative Injection"));
    result.add(new SelectItem("Annual Oil (bbl)", "Annual Oil (bbl)"));
    result.add(new SelectItem("Annual Gas (mcf)", "Annual Gas (mcf)"));
    result.add(new SelectItem("Annual Water (bbl)", "Annual Water (bbl)"));
    result.add(new SelectItem("Annual Injection", "Annual Injection"));
    result.add(new SelectItem("Water Cut", "Water Cut"));
    result.add(new SelectItem("Oil Cut", "Oil Cut"));
    result.add(new SelectItem("Gas/Oil Ratio", "Gas/Oil Ratio"));
    result.add(new SelectItem("Yield", "Yield"));
    result.add(new SelectItem("Water/Oil Ratio", "Water/Oil Ratio"));
    result.add(new SelectItem("Oil/Water Ratio", "Oil/Water Ratio"));
    result.add(new SelectItem("Water/Gas Ratio", "Water/Gas Ratio"));
    result.add(new SelectItem("Oil/Injection Ratio", "Oil/Injection Ratio"));
    result.add(new SelectItem("Injection/Oil Ratio", "Injection/Oil Ratio"));
    result.add(new SelectItem("Injection/(Oil+Water)", "Injection/(Oil+Water)"));
    result.add(new SelectItem("(Oil+Water)/Injection", "(Oil+Water)/Injection"));
    result.add(new SelectItem("Injection/Gas Ratio", "Injection/Gas Ratio"));
    result.add(new SelectItem("Gas/Injection Ratio", "Gas/Injection Ratio"));
    result.add(new SelectItem("Bottom Hole Pressure", "Bottom Hole Pressure"));
    result.add(new SelectItem("Flowing Pressure", "Flowing Pressure"));
    result.add(new SelectItem("Tubing Pressure", "Tubing Pressure"));
    result.add(new SelectItem("BHP/Z Pressure", "BHP/Z Pressure"));
    return result;
}

/**
 * all y, x axis scales.
 * 
 * @return
 */
public List<SelectItem> getAllScaleTypes() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem(0, "Linear"));
    result.add(new SelectItem(1, "Logarithmic"));
    return result;
}

/**
 * all y, x axis scale configurations.
 * 
 * @return
 */
public List<SelectItem> getScaleAutoOrCustom() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem(true, "Automatically scale to fit data"));
    result.add(new SelectItem(false, "Custom scale"));
    return result;
}

/**
 * all x axes.
 * 
 * @return all x axes
 */
public List<SelectItem> getAllXAxes() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem("Time", "Time"));
    result.add(new SelectItem("Cumulative Oil (bbl)", "Cumulative Oil   (bbl)"));
    result.add(new SelectItem("Cumulative Gas (mcf)", "Cumulative Gas   (mcf)"));
    result.add(new SelectItem("Cumulative Water (bbl)", "Cumulative Water   (bbl)"));
    result.add(new SelectItem("Cumulative Injection", "Cumulative   Injection"));
    return result;
}

/**
 * all graph titles.
 * 
 * @return all graph titles
 */
public List<SelectItem> getAllGraphTitles() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem("Custom", "Custom"));
    result.add(new SelectItem("Production ID", "Production ID"));
    result.add(new SelectItem("Lease Name", "Lease Name"));
    result.add(new SelectItem("Well Number", "Well Number"));
    result.add(new SelectItem("API Number", "API Number"));
    result.add(new SelectItem("API Unique Number", "API Unique Number"));
    result.add(new SelectItem("Operator", "Operator"));
    result.add(new SelectItem("First Production Date", "First Production Date"));
    result.add(new SelectItem("Last Production Date", "Last Production Date"));
    result.add(new SelectItem("Lease Type", "Lease Type"));
    result.add(new SelectItem("Lease Status", "Lease Status"));
    result.add(new SelectItem("Cumulative Oil", "Cumulative Oil"));
    result.add(new SelectItem("Cumulative Gas", "Cumulative Gas"));
    result.add(new SelectItem("Cumulative Water", "Cumulative Water"));
    result.add(new SelectItem("Cumulative Injection", "Cumulative Injection"));
    result.add(new SelectItem("State", "State"));
    result.add(new SelectItem("County", "County"));
    result.add(new SelectItem("Field", "Field"));
    result.add(new SelectItem("Reservoir", "Reservoir"));
    result.add(new SelectItem("Producing Zone", "Producing Zone"));
    result.add(new SelectItem("Location", "Location"));
    return result;
}

/**
 * all font sizes.
 * 
 * @return all font sizes
 */
public List<SelectItem> getAllFontSizes() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem(8, "8px"));
    result.add(new SelectItem(10, "10px"));
    result.add(new SelectItem(12, "12px"));
    result.add(new SelectItem(14, "14px"));
    result.add(new SelectItem(16, "16px"));
    result.add(new SelectItem(18, "18px"));
    result.add(new SelectItem(20, "20px"));
    result.add(new SelectItem(25, "25px"));
    result.add(new SelectItem(30, "30px"));
    result.add(new SelectItem(35, "35px"));
    result.add(new SelectItem(40, "40px"));
    result.add(new SelectItem(45, "45px"));
    return result;
}

/**
 * all styles.
 * 
 * @return all styles
 */
public List<SelectItem> getAllStyles() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem(0, "Bold"));
    result.add(new SelectItem(1, "Italic"));
    return result;
}

/**
 * all y titles.
 * 
 * @return all y titles
 */
public List<SelectItem> getAllYTitles() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    if (yAxes.size() == 0)
        result.addAll(getAllYAxes());
    else {
        for (String yAxis : yAxes) {
            result.add(new SelectItem(yAxis, yAxis));
        }
    }
    result.add(new SelectItem("Custom Title", "< Custom Title >"));
    return result;
}

/**
 * all x titles.
 * 
 * @return all x titles
 */
public List<SelectItem> getAllXTitles() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    if (xAxis == null)
        result.addAll(getAllXAxes());
    else
        result.add(new SelectItem(xAxis, xAxis));
    result.add(new SelectItem("Custom Title", "< Custom Title >"));
    return result;
}

/**
 * all line scales.
 * 
 * @return all line scales
 */
public List<SelectItem> getAllLineScales() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem(0.0329, "Daily"));
    result.add(new SelectItem(0.01, "X 0.01"));
    result.add(new SelectItem(0.1, "X 0.1"));
    result.add(new SelectItem(1.0, "X 1"));
    result.add(new SelectItem(10.0, "X 10"));
    result.add(new SelectItem(100.0, "X 100"));
    result.add(new SelectItem(1000.0, "X 1,000"));
    result.add(new SelectItem(10000.0, "X 10,000"));
    result.add(new SelectItem(100000.0, "X 100,000"));
    return result;
}

/**
 * all label positions.
 * 
 * @return all label positions
 */
public List<SelectItem> getAllLabelPositions() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem(0, "Line Start"));
    result.add(new SelectItem(1, "Line End"));
    return result;
}

/**
 * all legend titles.
 * 
 * @return all legend titles
 */
public List<SelectItem> getAllLegendTitles() {
    List<SelectItem> result = getAllGraphTitles();
    result.remove(0);
    return result;
}

/**
 * all extra properties.
 * 
 * @return all extra properties
 */
public List<SelectItem> getAllExtraProps() {
    List<SelectItem> result = new ArrayList<SelectItem>();
    result.add(new SelectItem(0, "Make this the default graph on the view Records page"));
    result.add(new SelectItem(1, "Allow other people in my company to use this graph"));
    return result;
}

private List<Integer> convertStylesAsList(int nStyles) {
    List<Integer> result = new ArrayList<Integer>();
    switch (nStyles) {
    case 0:
        break;
    case 1:
        result.add(0);
        break;
    case 4:
        result.add(1);
        break;
    case 5:
        result.add(0);
        result.add(1);
        break;
    default:
        throw new IllegalStateException(
                "The title sytle is not correct configured, probably the underlying graph template file is corrupted!");
    }
    return result;
}

private int convertStylesAsInteger(List<Integer> listStyle) {
    assert (listStyle != null);
    int result = 0;
    for (Integer style : listStyle) {
        switch (style) {
        case 0:
            result += 1;
            break;
        case 1:
            result += 4;
            break;
        default:
            throw new UnsupportedOperationException("Not implemented yet");
        }
    }
    return result;
}

private List<Integer> convertLabelPositionsAsList(int nLabelPositions) {
    List<Integer> result = new ArrayList<Integer>();
    switch (nLabelPositions) {
    case 0:
        break;
    case 1:
        result.add(0);
        break;
    case 2:
        result.add(1);
        break;
    case 3:
        result.add(0);
        result.add(1);
        break;
    default:
        throw new IllegalStateException(
                "The line sytle's lable positions is not correct configured, probably the underlying graph template file is corrupted!");
    }
    return result;
}

private int convertLabelPositionsAsInteger(List<Integer> listLabelPosition) {
    assert (listLabelPosition != null);
    int result = 0;
    for (Integer labelPosition : listLabelPosition) {
        switch (labelPosition) {
        case 0:
            result += 1;
            break;
        case 1:
            result += 2;
            break;
        default:
            throw new UnsupportedOperationException("Not implemented yet");
        }
    }
    return result;
}

public String create() throws GraphServiceException {
    logger.debug("create graph template......");
    /*
     * y, x axis data (step 1)
     */
    yAxes.add("Oil (bbl)");
    yScaleType = 1;
    yScaleIsAuto = true;
    xAxis = "Time";
    xScaleType = 0;
    xScaleIsAuto = true;
    /*
     * graph titles (step 2)
     */
    graphTitles.add("Lease Name");
    graphTitles.add("Well Number");
    graphTitles.add("API Number");
    graphTitleFontSize = 10;
    graphTitleColor = Color.BLACK;
    isMultiLines = false;
    yTitleFontSize = 10;
    yTitleColor = Color.BLACK;
    xTitleFontSize = 10;
    xTitleColor = Color.BLACK;
    /*
     * line styles (step 3)
     */
    for (LineStyle lineStyle : lineStyles) {
        lineStyle.setInUse(yAxes.contains(lineStyle.getyAxis()) ? true : false);
        lineStyle.setLineStyle(0);
        lineStyle.setLineScale(1.0);
        if (lineStyle.getyAxis().endsWith("Oil (bbl)"))
            lineStyle.setColor(Color.GREEN);
        else if (lineStyle.getyAxis().endsWith("Gas (mcf)"))
            lineStyle.setColor(Color.RED);
        else if (lineStyle.getyAxis().endsWith("Water (bbl)"))
            lineStyle.setColor(Color.BLUE);
        else if ("Water/Oil Ratio".equals(lineStyle.getyAxis()))
            lineStyle.setColor(Color.WHITE);
        else
            lineStyle.setColor(Color.BLACK);
        lineStyle.setLabelPositions(new ArrayList<Integer>());
    }
    /*
     * Define Legend (step 4)
     */
    isShowUserLegend = false;
    legendTitles.addAll(graphTitles);
    userLegendFontSize = 10;
    userLegendColor = Color.BLACK;
    isShowDataLegend = false;
    dataLegendFontSize = 10;
    dataLegendColor = Color.BLACK;
    /*
     * name and extra properties (step 5)
     */
    int max = 0;
    for (SelectItem selectItem : getAllGraphTemplates()) {
        if (selectItem.getLabel().indexOf("My Graph Template ") != -1
                && patInteger.matcher(selectItem.getLabel().substring(18)).matches()) {
            int sequence = Integer.parseInt(selectItem.getLabel().substring(18));
            if (sequence > max)
                max = sequence;
        }
    }
    name = "My Graph Template " + (max + 1);
    return "create";
}

public String save() throws GraphServiceException {
    logger.debug("save graph template......");
    GraphService gs = GraphServiceFactory.getInstance(getUser());
    GraphConfiguration graphConfiguration = null;
    MyTemplate myTemplate = null;
    if(id==0)
        id= null;
    if (id != null) {
        gs.setTemplateId(id);
        gs.loadGraphTemplate();
    }
    graphConfiguration = new GraphConfiguration();
    /*
     * y, x axis data (step 1)
     */
    for (int i = 0; i < yAxes.size(); i++) {
        GraphSeries graphSeries = new GraphSeries();
        graphSeries.setId(i + 1);
        AxisInfo yAxisInfo = new AxisInfo();
        yAxisInfo.setName(yAxes.get(i));
        yAxisInfo.setType(yScaleType);
        yAxisInfo.setAutoScale(yScaleIsAuto);
        if (!yScaleIsAuto) {
            yAxisInfo.setStartValue(yCustomNumStart.toString());
            yAxisInfo.setEndValue(yCustomNumEnd.toString());
            yAxisInfo.setTicks(yCustomNumTicMarks);
        }
        graphSeries.setY(yAxisInfo);
        AxisInfo xAxisInfo = new AxisInfo();
        xAxisInfo.setName(xAxis);
        xAxisInfo.setType(xScaleType);
        xAxisInfo.setAutoScale(xScaleIsAuto);
        if (!xScaleIsAuto) {
            boolean isTime = "Time".equals(xAxis);
            xAxisInfo.setStartValue(isTime ? yearFormat.format(xCustomDateStart) : xCustomNumStart.toString());
            xAxisInfo.setEndValue(isTime ? yearFormat.format(xCustomDateEnd) : xCustomNumEnd.toString());
            xAxisInfo.setTicks(isTime ? xCustomDateTicMarks : xCustomNumTicMarks);
        }
        graphSeries.setX(xAxisInfo);
        graphConfiguration.addSeries(graphSeries);
    }
    /*
     * graph titles (step 2)
     */
    GraphTitle graphTitle = new GraphTitle();
    for (String tmp : graphTitles)
        graphTitle.addStandardData(!"Custom".equals(tmp) ? tmp : graphCustomTitle);
    graphTitle.setSize(graphTitleFontSize);
    graphTitle.setColor(colorConverter.getAsString(null, null, graphTitleColor));
    graphTitle.setStyle(convertStylesAsInteger(graphTitleStyles));
    graphTitle.setMultiline(isMultiLines);
    AxisLabel yAxisLabel = new AxisLabel();
    yAxisLabel.setName(!"Custom Title".equals(yTitle) ? yTitle : yCustomTitle);
    yAxisLabel.setSize(yTitleFontSize);
    yAxisLabel.setColor(colorConverter.getAsString(null, null, yTitleColor));
    yAxisLabel.setStyle(convertStylesAsInteger(yTitleStyles));
    AxisLabel xAxisLabel = new AxisLabel();
    xAxisLabel.setName(!"Custom Title".equals(xTitle) ? xTitle : xCustomTitle);
    xAxisLabel.setSize(xTitleFontSize);
    xAxisLabel.setColor(colorConverter.getAsString(null, null, xTitleColor));
    xAxisLabel.setStyle(convertStylesAsInteger(xTitleStyles));
    graphConfiguration.setTitle(graphTitle);
    graphConfiguration.setYLabel(yAxisLabel);
    graphConfiguration.setXLabel(xAxisLabel);
    /*
     * line styles (step 3)
     */
    for (int i = 0; i < lineStyles.size(); i++) {
        LineStyle lineStyle = lineStyles.get(i);
        if (lineStyle.getInUse()) {
            Line line = new Line();
            line.setSeries(i + 1);
            line.setStyle(lineStyle.getLineStyle());
            line.setScale(lineStyle.getLineScale());
            line.setColor(colorConverter.getAsString(null, null, lineStyle.getColor()));
            line.setLabel(convertLabelPositionsAsInteger(lineStyle.getLabelPositions()));
            line.setLegend(true);
            graphConfiguration.addLine(line);
        }
    }
    /*
     * define legend (step 4)
     */
    if (isShowUserLegend) {
        UserLegend userLegend = new UserLegend();
        for (String legendTitle : legendTitles) {
            userLegend.addStandardData(legendTitle);
        }
        userLegend.setSize(userLegendFontSize);
        userLegend.setColor(colorConverter.getAsString(null, null, userLegendColor));
        userLegend.setStyle(convertStylesAsInteger(userLegendStyles));
        graphConfiguration.setUserLegend(userLegend);
    }
    if (isShowDataLegend) {
        DataLegend dataLegend = new DataLegend();
        dataLegend.setSize(dataLegendFontSize);
        dataLegend.setColor(colorConverter.getAsString(null, null, dataLegendColor));
        dataLegend.setStyle(convertStylesAsInteger(dataLegendStyles));
        graphConfiguration.setDataLegend(dataLegend);
    }
    /*
     * name and extra properties (step 5)
     */
    myTemplate = (id == null ? new MyTemplate() : gs.getTemplate());
    myTemplate.setName(name);
    myTemplate.setPath(getUser().getHomeDirectory() + GraphConfiguration.PATH + name);
    for (Integer extraProp : extraProps) {
        switch (extraProp) {
        case 0:
            myTemplate.setDefault(true);
            break;
        case 1:
            myTemplate.setPublic(MyTemplate.PUBLIC);
            break;
        default:
            throw new UnsupportedOperationException("Not implemented yet!");
        }
    }
    // save...
    if (id == null) {
        logger.info("new graph template......");
        gs.insertMyTemplate(graphConfiguration, myTemplate);
    } else {
        logger.info("update graph template(id) " + id);
        gs.updateMyTemplate(graphConfiguration, myTemplate);
    }
    return "success";
}
/**
* 
*@作者弗里曼·博耶
* 
*/
公共类GraphTemplateBean扩展了ThinBeanBase{
公共整数id=null;
公共整数getId(){
返回id;
}
公共无效集合id(整数id){
this.id=id;
}
/*
*y、x轴数据(步骤1)
*/
私有列表yAxes=new ArrayList();//y轴
私有整数yScaleType=null;//y轴刻度类型
私有布尔值yScaleIsAuto=null;//y轴比例为自动
private Double yCustomNumStart=null;//y自定义启动
private Double yCustomNumEnd=null;//y自定义结束
私有双yCustomNumTicMarks=null;//y自定义tic标记
私有字符串xAxis=null;//x轴
私有整数xScaleType=null;//x轴刻度类型
私有布尔值xScaleIsAuto=null;//x轴比例为自动
私有日期xCustomDateStart=null;//x轴自定义日期开始
private Double xCustomNumStart=null;//x轴自定义编号开始
私有日期xCustomDateEnd=null;//x轴自定义日期结束
private Double xCustomNumEnd=null;//x轴自定义编号结束
私有整数xCustomDateTicMarks=null;//x个自定义日期ticmarks
私有双精度xCustomNumTicMarks=null;//x自定义数字tic标记
/*
*图表标题(步骤2)
*/
private List graphTitles=new ArrayList();//图形标题
私有字符串graphCustomTitle=null;//图形自定义标题
私有整数graphTitleFontSize=null;//图形标题字体大小
专用颜色graphTitleColor=null;//图形标题颜色
私有列表graphTitleStyles=新ArrayList();//图形标题样式
私有布尔isMultiLines=null;//是多行
私有字符串yTitle=null;//y标题
私有字符串yCustomTitle=null;//y自定义标题
私有整数yTitleFontSize=null;//y标题字体大小
私有颜色yTitleColor=null;//y标题颜色
私有列表yTitleStyles=新ArrayList();//y标题样式
私有字符串xTitle=null;//x title
私有字符串xCustomTitle=null;//x自定义标题
私有整数xTitleFontSize=null;//x标题字体大小
私有颜色xTitleColor=null;//x标题颜色
私有列表xTitleStyles=new ArrayList();//x标题样式
/*
*线条样式(步骤3)
*/
私有列表线型=新建ArrayList();//线型
/*
*定义图例(步骤4)
*/
私有布尔值isShowUserLegend=null;
私有列表legendTitles=新ArrayList();
私有整数userLegendFontSize=null;
私有颜色userLegendColor=null;
private List userLegendStyles=new ArrayList();
私有布尔值isShowDataLegend=null;
私有整数dataLegendFontSize=null;
专用颜色dataLegendColor=null;
private List dataLegendStyles=new ArrayList();
/*
*名称和额外属性(步骤5)
*/
私有字符串名称=null;//图形模板名称
private List extraProps=new ArrayList();//图形模板的额外属性
公共GraphTemplateBean(){
debug(“新图形模板bean请求……”);
对于(SelectItem SelectItem:getAllYAxes()){
LineStyle LineStyle=新线型();
lineStyle.setyAxis(selectItem.getLabel());
线型。添加(线型);
}
info(“GraphTemplateBean已创建”);
}
..............
/**
*从头开始创建类型或保存的图形模板。
* 
*@从零开始返回或保存
*/
公共列表getFromScratchOrSaved(){
列表结果=新建ArrayList();
结果.add(newselectItem(true,“从头创建新图形”);
结果.添加(新建SelectItem(false,“从保存的图形开始:”);
返回结果;
}
/**
*所有图形模板
* 
*@返回所有图形模板
*@抛出GraphServiceException
*/
public List getAllGraphTemplates()引发GraphServiceException{
列表结果=新建ArrayList();
GraphService gs=GraphServiceFactory.getInstance(getUser());
List graphTemplates=gs.listMyTemplate();
对于(MyTemplate graphTemplates:graphTemplates){
添加(新的SelectItem(graphTemplate.getId(),graphTemplate.getName());
}
返回结果;
}
/**
*所有y轴。
* 
*@返回所有y轴
*/
公共列表getAllYAxes(){
列表结果=新建ArrayList();
结果。添加(新选择项(“油(bbl)”、“油(bbl)”);
结果。添加(新选择项(“气体(mcf)”,“气体(mcf)”);
结果。添加(新选择项(“水(bbl)”,“水(bbl)”);
结果。添加(新选择项(“注射”、“注射”));
结果。添加(新选择项(“历史井计数”、“历史井计数”);
结果。添加(新选择项(“累积油量(bbl)”,“累积油量(bbl)”);
结果。添加(新选择项(“累积气体(mcf)”,“累积气体(mcf)”);
结果。添加(新选择项(“累积水(bbl)”,“累积水(bbl)”);
结果.添加(新选择项(“累积注射”、“累积注射”));
<h:inputText id="userNo" value="#{UserNumberBean.userNumber}">
<f:validateLongRange minimum="0" maximum="10" /> 
</h:inputText>