0
votes

Currently in a web app project where I upload 1 value and 1 multifile as a form in jsp. I have already tried my first chartType can be use as a property but not the other two.

Running with : java spring, mnv, jsp

JSP

<c:if test="${not empty chart}" var="charts">
        <div id="container" style="height: 400px; width: 250px"></div>
        <script type="text/javascript"> 
            Highcharts.chart('container', {
                chart: {
                    type: '${chart.chartType}'
                },
                title: {
                    text: '${chart.chartTittle}'
                },
                subtitle: {
                    text: '${chart.chartSubTittle}'
                },

MNV

@PostMapping("/save-chart")
public ModelAndView saveChart(@RequestParam("chartType")String chartType,@RequestParam("excelFile") MultipartFile file) throws Exception {
    
    Chart chart = new Chart();
    uploadExcel x = new uploadExcel();
    
    String tittle = x.uploadTittle(file);
    String subTittle = x.uploadSubTittle(file);
    
    //if (tittle != null) {
    //  chart.setchartTittle(tittle);
    //}else {
    //  chart.setchartTittle("null");
    //}
    
    //if (tittle != null) {
    //  chart.setchartSubTittle(subTittle);
    //}else {
    //  chart.setchartSubTittle("null");
    //}
    chart.setchartTittle("null");
    chart.setchartSubTittle("null");
    
    chart.setChartType(chartType);
    
    ModelAndView modelAndView = new ModelAndView("dashboardpage");
    modelAndView.addObject("chart",chart);
    return modelAndView;
}

error 'Property [chartTittle] not readable on type [com.si.dashboard.model.Chart] javax.el.PropertyNotFoundException: Property [chartTittle] not readable on type [com.si.dashboard.model.Chart]'

chart.java

@Table (name = "chart") public class Chart {

@Column (name = "xAxisValue")
public String xAxisValue ;
@Column (name="yAxisValue")
String yAxisValue ;
@Column (name="xAsixName")
String xAxisName;
@Column (name="yAxisName")
String yAxisName;
@Column (name="chartType")
public String chartType;
@Column (name="chartTittle")
public String chartTittle;
@Column (name="chartSubTittle")
public String chartSubTittle;
@Column (name="startValue")
String startValue;

public Chart() {
    
}

public String getChartType() {
    return chartType;
}

public void setChartType(String x) {
    this.chartType = x;
}

public String getTittle() {
    return chartTittle;
}

public void setchartTittle(String x) {
    this.chartTittle = x;
}

public String getchartSubTittle() {
    return chartSubTittle;
}

public void setchartSubTittle(String x) {
    this.chartSubTittle = x;
}

public String getxAxisName() {
    return xAxisName;
}

public void setxAxisName(String x) {
    this.xAxisName = x;
}

public String getyAxisName() {
    return yAxisName;
}

public void setyAxisName(String x) {
    this.yAxisName = x;
}

public String getxAxisValue() {
    return xAxisValue;
}

public void setxAxisValue(String x) {
    this.xAxisValue = x;
}

public String getyAxisValue() {
    return xAxisValue;
}

public void setyAxisValue(String x) {
    this.yAxisValue = x;
}

public String getStartValue() {
    return startValue;
}

public void setStartValue(String x) {
    this.startValue = x;
}

@Override
public String toString() {
    return "Chart [chartTittleittle=" + chartTittle + ", chartSubTittle=" + chartSubTittle + "]";
}

}

1
The English word title is not spelled with a double t in the middle. I don’t know whether this has got anything to do with your error.Ole V.V.
should not be, english word tittle is in jsp and is a form of javascript, my tittle variable is from the java servletChew Yiwei
in jsp, you had "title" spelt correctly.Deadbeef
to prove your point i already change all tittle to title, now the error is boldProperty [chartTitle] not readable on type [com.si.dashboard.model.Chart] javax.el.PropertyNotFoundException: Property [chartTitle] not readable on type [com.si.dashboard.model.Chart]Chew Yiwei
so it is the same, it does not matter if i change my variable nameChew Yiwei

1 Answers

1
votes

Okay guy so i figure the way, JSP actually called the chart and by missing a capital letter from my getter getchartTittle to getChartTittle, does the job, thanks everyone.