我试图使用相同的视图来显示基于我从JSP中的按钮传递的参数的不同列表。
我需要的是:当用户点击按钮时,将调用相同的视图,但数据应显示在第二个列表中。(getPreviousYearReports())
这是我的代码:
@RequestMapping(value = "/viewReports.do", method = {RequestMethod.GET , RequestMethod.POST})
public ModelAndView viewReports( @RequestParam final Integer storeNumber,
final HttpServletRequest request) {
ModelAndView view = getModelAndView("viewReports");
List<StoreReport> reportsList;
if(request.getParameter("previous") != null ) {
reportsList = storeReportService.getPreviousYearReports(storeNumber);
} else {
reportsList = storeReportService.getReportsByStore(storeNumber);
}
....
}
在我的JSP中。 我添加了提交按钮来调用相同的视图映射
<button id="previous" name="previous" type="submit" class="btnFwd gradient smButtonStyling"
onClick="window.location.href='/viewReports.do?storeNumber=${storeNumber}'">
View Previous Year Reports
答案 0 :(得分:0)
我错过了通过“&amp; previous”param
CONFIG: 204658E4 SQL: select *
from table
where column = :1
java.lang.Throwable: No Error
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1624)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4347)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:4426)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:4733)
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:125)
at com.sun.proxy.$Proxy60.executeQuery(Unknown Source)
at sqlj.runtime.ExecutionContext$OracleContext.oracleExecuteQuery(ExecutionContext.java:71)
at me.loadQuery(DataBean.java:364)
at me.loadQuery(DataBean.java:411)
at org.apache.jsp.jsp.secure.navigate_jsp.displayMenu(navigate_jsp.java:43)
at org.apache.jsp.jsp.secure.navigate_jsp._jspService(navigate_jsp.java:472)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)