0

I am new to Spring MVC and I am kind of stuck debugging this issue. I fetch some details from my database and send them to the JSP from my controller, and I am able to display it properly. When I am trying to submit the same form back to the controller for some testing purpose, few of the attribute values are null.

class Quote(){
    int id;
    String name;
    //getters and setter
}

class QuotesForm(){
    List<Quote> quotesList = new ArrayList<Quote>();
    //getters and setters
}


@Controller
class TestController{

        @RequestMapping(value = "/update_quotes", method = RequestMethod.POST)
        public String updateQuotes(@ModelAttribute("quotesForm") QuotesForm quotesForm,
                ModelMap model,
                HttpServletRequest request) {
            logger.info("update quotes method invoked");
            logger.info("quotesForm size " + quotesForm.getQuotesList().size());

            for (Quote quote : quotesForm.getQuotesList()) {
                logger.info(quote.getId() + " , " + quote.getName());
             }
           return "/list_quotes";
          }
}

This is my jsp (preview)

    <form:form id="quotes_form" action="${pageContext.request.contextPath}/update_quotes" method="post" modelAttribute="quotesForm">
        <table>
            <c:forEach items="${quotesForm.quotesList}" var="quote" varStatus="status">
                <tr>
                    <td>    <form:input path="verticalsList[${status.index}].id" value="${quote.id}"/></td>
                    <td>   <form:input path="quotesList[${status.index}].name" value="${quote.name}" readonly="true"/></td>
                </tr>
            </c:forEach>
            <tr>
            <td colspan="2"> <input type="submit" value="Update" onclick='$("#quotes_form").submit();' /> </td>
            <tr>
        </table>
    </form:form>

This is my controller log

2014-04-08 10:56:18,486 [http-bio-8080-exec-8] INFO  ui.controller.TestController  - 1223 , Think like a proton... always positive...
2014-04-08 10:56:18,486 [http-bio-8080-exec-8] INFO  ui.controller.TestController  - 1224 , The best feeling on earth is love, and the worst feeling on earth is death...
2014-04-08 10:56:18,486 [http-bio-8080-exec-8] INFO  ui.controller.TestController  - 1225 , You cannot hide from yourself...
2014-04-08 10:56:18,486 [http-bio-8080-exec-8] INFO  ui.controller.TestController  - 1226 , null
2014-04-08 10:56:18,486 [http-bio-8080-exec-8] INFO  ui.controller.TestController  - 1227 , null
2014-04-08 10:56:18,486 [http-bio-8080-exec-8] INFO  ui.controller.TestController  - 1228 , null
2014-04-08 10:56:18,486 [http-bio-8080-exec-8] INFO  ui.controller.TestController  - 1229 , null

Please help me understand and fix the issue and if you need any info further

Karthik
  • 75
  • 2
  • 8

1 Answers1

0

Just to let others know; I checked my logs in detail and found that the actual issue is that the tomcat container could not handle more than 10000 key/parameter-value pairs in a given GET/POST request. I referred to this link and added the maxParameterCount="100000" to my tomcat server.xml and it resolved the issue.

Community
  • 1
  • 1
Karthik
  • 75
  • 2
  • 8
  • Exceeding 10.000 request parameters! Really? – Bart Apr 09 '14 at 05:14
  • Yes, thats what the log console says when I submit my form back to the controller. My actual form has a table with 2000+ records and each record (row) with 4 fields (columns). When I look at the code generated for the Spring Form tags, each column () has 5 attributes – Karthik Apr 09 '14 at 05:55