Spring MVC getting value of element that is not an object property on the server

I have a jsp page which uses spring tag lib. I have elements on he page that is bind to properties of an object. I also have button values that are not bind to the POJO i am trying to get these values on the server. Under is the code

JSP

<body>
    <form:form id="monitoringList" name="monitoringList" commandName="monitoring">
    <h3>Monitoring For Criminals Victims/Wittiness</h3>
        <h3>Crime Record - ${crimeRecNo}</h3>       

        <div id="victims">
        <h3>Victims</h3>
        <hr>
            <input type="hidden" id="records" value="${records}"/>



            <div id="citizen_row">          

            <label class="name"></label>

            <form:input class="citizen" type="hidden" name="socialSecurityNumber" path="socialSecurityNumber"/>

            <table border="1">          

            <tr>

            <td><form:input type="hidden" path="crimeRecNo" name = "crimeRecNo"/>
            <canvas id="photoCvs${citizen.socialSecurityNumber}" class="canvas" height="200" width="200"></canvas></td>
            <td><label>Start Date : </label><form:input name= "monitoringStDate" path="monitoringStDate" id="monitoringStDate"/></td>
            <td><label>End Date : </label><form:input name="monitoringEndDate" path="monitoringEndDate" id="monitoringEndDate"/></td>
            <td>
            <label>Monitoring Type : </label>
                <form:select path="monitoringTypeId" name="monitoringTypeId" id="monitoringTypeId" title="Monitoring Type">
                    <form:options items="${monitoringType.monitoringTypeList}" itemValue="monitoringTypeId" itemLabel="monitoringTypeDesc" />
                </form:select>              
            </td>
            </tr>

            </table>

            <div><button id="action" onclick="submitPage('${pageContext.request.contextPath}/monitoringList.htm','POST');" type="button">Create Monitoring Records</button></div>

            </div>

            <!-- MySql first record starts at 0. So we need to send in the value 0 to get the first record. Create Record Navigation based on record count -->
            <div id= "recordNavigation">
            <c:forEach begin="0" end="${records - 1}" var="i"> 
                <input type="submit" class="navigationbtns" id="page" onclick="submitPage('${pageContext.request.contextPath}/monitoringList.htm','POST');" value="${i}"/>
            </c:forEach>
            </div>

        </div>

    </form:form>
</body>

This is the controller and i am using request.getParameter to get the value of the button however the value id null when i click on the button which post me to the server

Controller

@RequestMapping(value = "monitoringList.htm", method = RequestMethod.POST)
public ModelAndView handleNextMonitoringPage(@ModelAttribute("crimeRecNo")Integer crimeRecNo, Model model,@ModelAttribute Monitoring monitoring, BindingResult result,ModelMap m,HttpServletRequest request,SessionStatus status, HttpSession session) throws Exception {

    String p_page = request.getParameter("page");
    logger.info("Page request was ::" + p_page);
    //int page = 0;

myMonitoringTypeList.put("monitoringTypeList",this.monitoringTypeManager.getListOfMonitoringType());

     model.addAttribute("monitoringType",myMonitoringTypeList);
     Monitoring aMonitoringRecord = new Monitoring();

aMonitoringRecord = this.monitoringManager.getAMonitoringRecByCrimeRecNo(crimeRecNo, page);
int recordCount = this.monitoringManager.MonitoringRecords_RecordCount(crimeRecNo);

     model.addAttribute("records",recordCount);
     model.addAttribute("crimeRecNo", crimeRecNo);
     model.addAttribute("monitoring", aMonitoringRecord);           

    return new ModelAndView(new RedirectView("monitoringList.htm"),"page",page); 

}

Answers


you are missing the name attribute under which the value is being submitted

<button name="page" ....>

and

<input type="submit" name="page" ..../>

Need Your Help

Not able to render SVG image in Safari

html5 safari web svg rendering

As the title states, I have a svg image, but I am not able to render it in safari, and opera. But it works perfectly fine in Firefox. I found this post

Inflating SupportMapFragment with Google Maps v2 causes ClassNotFoundException

android android-intent google-maps-api-2 google-maps-android-api-2

I want to start an Intent with a Google Maps fragment. The sample code of Google Play Services works fine but I don't get these maps running in my application. My referenced libraries are:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.