getparametervalues方法在Spring中不起作用

时间:2015-12-07 18:22:52

标签: spring jsp model-view-controller

我的获取ParameterValues方法不起作用,我试图从JSP页面检索值到MVC控制器下面是MVC页面的代码snipet

@RequestMapping(value="/searchQuery", method=RequestMethod.POST)
        public ModelAndView submitForm(HttpServletRequest request, ModelAndView model) {
        System.out.println("Called submitfform method");
        String[] listBox1 = request.getParameterValues("selectedright");
        String[] listBox2 = request.getParameterValues("selectedright2");
        String to_date=request.getParameter("date1");
        String from_date=request.getParameter("date2");
        System.out.println(listBox1);
        System.out.println(listBox2);
        List<ItemMaster> lists=itemDao.fetchRecords(listBox1,listBox2,to_date,from_date);
        model.addObject("queryResult",lists);
        model.setViewName("results");
        System.out.println(lists.size());
          //  m.addAttribute("message", "Successfully Requested person: " + adhoc.toString());
            return model;
        }

下面是我试图检索整个JSP页面的JSP页面的snipet是大到要粘贴在这里。

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>ADHOC Report</title>
<link rel="stylesheet"
href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
<! -- My Functions >
 </script>

</head>
<BODY id="body" bgcolor="#f5f5f5" onload="preventBack();">
<!-- <onpageshow="if(event.persisted) preventBack();"> -->


<form:form action="searchQuery" method="post">
    <table width="100%" height="30%" border="1" align="center"
        cellpadding="4" style="text-align: center; background-color: white">
    </table>
    <br>

0 个答案:

没有答案