Note that there are some explanatory texts on larger screens.

plurals
  1. PONeither BindingResult nor plain target object for bean name available as request attr
    text
    copied!<hr> <p>Hi Experts, I have this controller code which is throwing the above mentioned error. It was working fine till yesterday, I have no clue what colleague did to this code and today I am seeing the error:</p> <p>Neither BindingResult nor plain target object for bean name 'sideForm' available as request attribute </p> <p>Can you please suggest me where to look for this kind of error. Am I making any mistake in POST or GET method declaration or returning something wrong?</p> <p>Your help is greatly appreciated :)</p> <pre><code>package com.att.analytics.ui; import java.util.Arrays; import java.util.Collection; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.si.myworld.business.AdminChart; import com.si.myworld.business.Chart; import com.si.myworld.dao.AdminChartSummaryData; import com.si.myworld.dao.BulletinData; import com.si.myworld.dao.ChartData; @RequestMapping("/index.html") @Controller public class IndexController { private static final Logger log = Logger.getLogger(IndexController.class); /** * Called to load the page initially (GET request) * * @param model * @return */ @RequestMapping(method = RequestMethod.GET) public String getCharts(ModelMap model) { Chart chart = new Chart(); chart.setTimeline("Monthly"); chart.setStartDt("mm/dd/yyyy"); chart.setEndDt("mm/dd/yyyy"); AdminChartSummaryData acsd = new AdminChartSummaryData(); List&lt;AdminChart&gt; list = acsd.getLandingChartDataList(); if (list.size() == 4) { Chart chart1 = new Chart(list.get(0)); Chart chart2 = new Chart(list.get(1)); Chart chart3 = new Chart(list.get(2)); Chart chart4 = new Chart(list.get(3)); model.put("chart1", chart1); model.put("chart2", chart2); model.put("chart3", chart3); model.put("chart4", chart4); log.info("chart 1&gt;&gt;&gt;&gt;" + chart1); ChartData cd = new ChartData(); String chartOneDatasource = cd.fetchChartDatasourceName(chart1 .getChartSubgroup()); String chartTwoDatasource = cd.fetchChartDatasourceName(chart2 .getChartSubgroup()); String chartThreeDatasource = cd.fetchChartDatasourceName(chart3 .getChartSubgroup()); String chartFourDatasource = cd.fetchChartDatasourceName(chart4 .getChartSubgroup()); String breadcrumbOne = chart1.getChartGroup() + "&gt;&gt;" + chart1.getChartSubgroup(); String breadcrumbTwo = chart2.getChartGroup() + "&gt;&gt;" + chart2.getChartSubgroup(); String breadcrumbThree = chart3.getChartGroup() + "&gt;&gt;" + chart3.getChartSubgroup(); String breadcrumbFour = chart4.getChartGroup() + "&gt;&gt;" + chart4.getChartSubgroup(); BulletinData bd = new BulletinData(); String bulletin = bd.getBulletinData(); model.put("sideForm", chart); model.put("chartOneDatasource", chartOneDatasource); model.put("chartTwoDatasource", chartTwoDatasource); model.put("chartThreeDatasource", chartThreeDatasource); model.put("chartFourDatasource", chartFourDatasource); model.put("breadcrumbOne", breadcrumbOne); model.put("breadcrumbTwo", breadcrumbTwo); model.put("breadcrumbThree", breadcrumbThree); model.put("breadcrumbFour", breadcrumbFour); model.put("bulletin", bulletin); } return "land"; } @RequestMapping(method = RequestMethod.POST) public String loadCharts(HttpServletRequest request, ModelMap model, @ModelAttribute("sideForm") Chart chart) { String from_date = request.getParameter("startDt"); String to_date = request.getParameter("endDt"); chart.setStartDt(from_date); chart.setEndDt(to_date); ChartData cd = new ChartData(); BulletinData bd = new BulletinData(); String bulletin = bd.getBulletinData(); AdminChartSummaryData acsd = new AdminChartSummaryData(); List&lt;AdminChart&gt; list = acsd.getLandingChartDataList(); if (list.size() == 4) { Chart chart1 = new Chart(list.get(0)); Chart chart2 = new Chart(list.get(1)); Chart chart3 = new Chart(list.get(2)); Chart chart4 = new Chart(list.get(3)); model.put("chart1", chart1); model.put("chart2", chart2); model.put("chart3", chart3); model.put("chart4", chart4); String chartOneDatasource = cd.fetchChartDatasourceName(chart1 .getChartSubgroup()); String chartTwoDatasource = cd.fetchChartDatasourceName(chart2 .getChartSubgroup()); String chartThreeDatasource = cd.fetchChartDatasourceName(chart3 .getChartSubgroup()); String chartFourDatasource = cd.fetchChartDatasourceName(chart4 .getChartSubgroup()); model.put("chartOneDatasource", chartOneDatasource); model.put("chartTwoDatasource", chartTwoDatasource); model.put("chartThreeDatasource", chartThreeDatasource); model.put("chartFourDatasource", chartFourDatasource); String breadcrumbOne = chart1.getChartGroup() + "&gt;&gt;" + chart1.getChartSubgroup(); String breadcrumbTwo = chart2.getChartGroup() + "&gt;&gt;" + chart2.getChartSubgroup(); String breadcrumbThree = chart3.getChartGroup() + "&gt;&gt;" + chart3.getChartSubgroup(); String breadcrumbFour = chart4.getChartGroup() + "&gt;&gt;" + chart4.getChartSubgroup(); model.put("breadcrumbOne", breadcrumbOne); model.put("breadcrumbTwo", breadcrumbTwo); model.put("breadcrumbThree", breadcrumbThree); model.put("breadcrumbFour", breadcrumbFour); } return "land"; } @ModelAttribute("timeline") public Collection&lt;String&gt; populateTimeline() { return Arrays.asList("Daily", "Weekly", "Monthly", "Quarterly", "Annually", "12_Month_Rolling"); } } </code></pre> <p>This page gets values from a form shown below:</p> <pre><code>&lt;form:form commandName="sideForm"&gt; &lt;div style="font-weight:bold; color:#000"&gt;Timeline&lt;/div&gt; &lt;div style="margin:0 0 5px 0;"&gt;&lt;form:select path="timeline" items="${timeline}" id="tm"/&gt;&lt;/div&gt; &lt;div class="tofrom"&gt;From:&lt;/div&gt; &lt;form:input path="startDt" id="from_date" size="7" maxlength="10" /&gt; &lt;div class="tofrom"&gt;To:&lt;/div&gt; &lt;form:input path="endDt" id="to_date" size="7" maxlength="12" /&gt; &lt;input type="submit" value="Update Chart" /&gt; &lt;/form:form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload