投网贷收益,怎么样才能拿到12%的收益

spring使用MultiActionController的时候提交表单如何绑定集合?
spring使用MultiActionController的时候提交表单如何绑定集合?
第一次提示是空的,手动实例化后却又提示下标越界。。。
以下是代码
&form method=&post& action=&${contextPath}/checkStoreAction/check.do& name=&trafficlistform& id=&trafficlistform&&
&input type=&hidden& name=&trafficNo& /&
&input type=&hidden& name=&checkDetailList[0].factData&
实体对象:
public class TobaccoCheck implements Serializable {
private static final long serialVersionUID = 1L;
private String trafficNo; //TRAFFIC_NO 调运单号
private List&TobaccoCheckDetail& checkDetailList=new ArrayList&TobaccoCheckDetail&();
public String getTrafficNo() {
return trafficNo;
public void setTrafficNo(String trafficNo) {
this.trafficNo = trafficNo;
public List&TobaccoCheckDetail& getCheckDetailList() {
return checkDetailL
public void setCheckDetailList(List&TobaccoCheckDetail& checkDetailList) {
this.checkDetailList = checkDetailL
public class TobaccoCheckDetail implements Serializable {
private Integer factD//FACT_DATA 调拨数量
public Integer getFactData() {
return factD
public void setFactData(Integer factData) {
this.factData = factD
&action部分
@Controller
public class CheckStoreAction extends MultiActionController {
@Resource(name=&tobaccoInfoBusiness&)
public ITobaccoInfoBusiness tobaccoInfoB
* 质检方法
* @param request HttpServletRequest
* @param response HttpServletResponse
* @throws Exception
@RequestMapping(value=&/checkStoreAction/check.do&, method = RequestMethod.POST)
public ModelAndView check(HttpServletRequest request,
HttpServletResponse response,@ModelAttribute(&trafficlistform&)TobaccoCheck check) throws Exception {
System.out.println(&check.getTrafficNo()==&+check.getTrafficNo()); //此属性可以正常填充
System.out.println(&check.getCheckTotalData==&+check.getCheckTotalData()); //此集合属性会下标越界
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
request.setAttribute(&msg&, &系统错误&);
return new ModelAndView(&checkStore/check_form&);
异常信息:
10:16:58 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet Dispatcher threw exception
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:566)
at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:451)
at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:428)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
at org.springframework.validation.DataBinder.applyPropertyValues(DataBinder.java:532)
at org.springframework.validation.DataBinder.doBind(DataBinder.java:434)
at org.springframework.web.bind.WebDataBinder.doBind(WebDataBinder.java:147)
at org.springframework.web.bind.ServletRequestDataBinder.bind(ServletRequestDataBinder.java:108)
at org.springframework.web.servlet.mvc.multiaction.MultiActionController.bind(MultiActionController.java:491)
at com.hbjy.web.action.CheckStoreAction.bind(CheckStoreAction.java:243)
at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:431)
at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:372)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:857)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:792)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:461)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:426)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source):转载时请以超链接形式标明文章原始出处和作者信息及本声明
新建一个controller类名为MultiController
写两个方法,add和update
package com.tgb.web.
import org.springframework.web.servlet.ModelAndV
import org.springframework.web.servlet.mvc.multiaction.*;
import java.util.*;
public class MultiController extends MultiActionController {
&&&&&&&& public ModelAndView add(){
&&&&&&&&&&&&&&&&&&
&&&&&&&& }
&&&&&&&&&&&&&&&&&& public ModelAndView update(){
&&&&&&&&&&&&&&&&&&
&&&&&&&& }
修改springmvc配置文件
Springmvc-servlet.xml加入bean
&bean id="paramMethodResolver" class="org.springframework.web.servle.mvc. multiaction.ParameterMethodNameResolver"&
&&& &property name="paramName" value="action"&&/property&
&& &/bean&
bean加入刚才新建的controller
&bean name="/test1/multi" class="com.tgb.web.controller.MultiController"&
&& &property name="methodNameResolver"&
&& &&&& &ref bean="paramMethodResolver"/&
&& &/property&
&& &/bean&
配置参数名称解析器paramMethodResolver,spring自带的,我们注入即可。
解析器是靠什么解析,是paramName配置了action,请求的时候靠这个来解析的。
配置刚才新建的controller,给他配置解析器。
这样配置完了就ok了。
springMVC-servlet.xml整体内容如下:
&?xml version="1.0" encoding="UTF-8"?& &
&beans xmlns="http://www.springframework.org/schema/beans" &
& & xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &
& & xmlns:p="http://www.springframework.org/schema/p" &
& & xmlns:mvc="http://www.springframework.org/schema/mvc" &
& & xmlns:context="http://www.springframework.org/schema/context" & & &&
& & xsi:schemaLocation="http://www.springframework.org/schema/beans&
& & http://www.springframework.org/schema/beans/spring-beans-3.0.xsd &
& & & & & & http://www.springframework.org/schema/context&
& & & & & & http://www.springframework.org/schema/context/spring-context-3.0.xsd &
& & & & & & http://www.springframework.org/schema/mvc&
& & & & & & http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd"& &
& & &&bean name="/test1/multi" class="com.tgb.web.controller.MultiController"&
& &&property name="methodNameResolver"&
& &&ref bean="paramMethodResolver"/&
& &&/property&
& &&/bean&
& &&bean name="/test1/helloworld" class="com.tgb.web.controller.HelloWorldController"&&/bean&
& &&bean id="paramMethodResolver" class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver"&
&property name="paramName" value="action"&&/property&
& &&/bean&
& &&bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"&
& &&property name="prefix" value="/"&&/property&
& &&property name="suffix" value=".jsp"&&/property&
& &&/bean&
Controller加入方法
package com.tgb.web.
import javax.servlet.http.HttpServletR
import javax.servlet.http.HttpServletR
import org.springframework.web.servlet.ModelAndV
import org.springframework.web.servlet.mvc.C
import org.springframework.web.servlet.mvc.multiaction.MultiActionC
import java.util.*;
public class MultiController extends MultiActionController {
public ModelAndView add(HttpServletRequest request,HttpServletResponse response){
System.out.println("--------add----------");
return new ModelAndView("/multi","method","add");
public ModelAndView update(HttpServletRequest request,HttpServletResponse response){
System.out.println("--------update----------");
return new ModelAndView("/multi","method","update");
新建view&multi.jsp
Copy上面的welcome.jsp,生成一个新的jsp:multi.jsp,修改jsp代码如下:
&%@ page language="java" contentType="text/ charset=UTF-8"
& & pageEncoding="UTF-8"%&
&%@ taglib prefix="c" uri="/jsp/jstl/core"%&
&!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&
&meta http-equiv="Content-Type" content="text/ charset=UTF-8"&
&title&Insert title here&/title&
&h&多方法的Controller&/h&
本次方法是${method }
重启tomcat,访问add页面
访问update页面
http://localhost:8080/springMVC2/test1/multi?action=update
历史上的今天:
引用地址:
flab:xingxing:fxfsmile:fxfsmile:fxfsmile:fxfsmile::lan:lan:fxzeng:
访问统计:用手机扫描以上二维码直接访问此文。
设计使用MultiActionController心得
今天总结一下在一个Spring的项目中使用MultiActionController的应用小结。
在项目开发过程中,面对一个需要对一个域对象进行查询明细,查询列表和查询该域对象的关联对象的案例,这里不包括对域对象进行更新的工作,这样如果采用实现Controller接口的话,每个实现类执行handleRequest返回ModelAndView来达到目的,很自然的将会产生3个实现类,这样项目的类文件数量增多,而且在以后维护工作中,虽然在一个用例中,仍然不得不从配置文件下手,一个一个根据映射找出对应的相应的Controller,这添加了维护的难度,所以这里我们很自然的采用了MultiActionController做实现。代码基本类似如下:
public class BookMultiController extends MultiActionController{
public ModelAndView getBook(HttpServletRequest request,
HttpServletResponse response) {
ModelAndView mv = new ModelAndView(&book/book_detail&);
Book book = bookManager.getBook(request.getParameter(&bookId&));
mv.addObject(&book&, book);
public ModelAndView getBookList(HttpServletRequest request,
HttpServletResponse response) {
ModelAndView mv = new ModelAndView(&book/book_list&);
Book book = new Book();
BeanUtils.populate(book, request.getParameterMap());
List list = bookManager.getBooks(book);
mv.addObject(&bookList&, list);
public ModelAndView getAuthorByBook(HttpServletRequest request,
HttpServletResponse response) {
ModelAndView mv = new ModelAndView(&author/author_detail&);
Author author = authorManager.getAuthorByBookId(request.getParameter(&bookId&));
mv.addObject(&author&, author);
在Url配置映射方面,我们使用了org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver,所以上述代码
的访问是:
book.do?method=getBook&bookId=123;
book.do?method=getBookList&bookName=JavaDesign&price=100;
book.do?method=getAuthorByBook&bookId=123;
这样实现下来似乎很不错了。但是在开发过程中,这样情况还会出现很多,当我们碰到一个综合查询的时候,往往会有一颗树,点击树的每一个节点,通过传递一些参数,我们需要看到想要的结果显示在正确的页面。如果采用实现Controller的方法,那么每一个节点的点击将具体的对应到一个相应,通过处理返回ModelAndView。如果考虑这颗树的节点很多,那么是否应该随着节点的不断增加,controller也不断的增加,配置文件的不断增加呢?如果不这样,是否还是考虑使用MultiActionController呢?在这里我们的选择还是使用MultiActionController来实现,不过带来的后果就是有多少个节点,就意味着MultiActionController有多少个对应的方法执行来返回ModelAndView。在这里已经假设节点有很多的情况,那么就意味着这个Controller随着执行方法的增加,代码也会会很冗长。如果有30个节点的话,上面的方法将会有30个,代码一多,这时仔细看看,其实他们都很薄,也都很相似。这里薄和相似是他们
都没有像SimpleFormController那样需要绑定对象,对对象进行验证,保存和更新的动作,他们都是从用户请求那里拿到参数,然后返回给用户希望得到的东西,这就足够了。所以我们在这个基础上加了一些东西,让这些事情做起来更容易一些,在MultiActionController注入了一个IRequestHandler,由它来完成上述的需求,这样30个方法的查询,实现起来至多也就是2个。拿一开始的用例来举例,代码:
public ModelAndView query(HttpServletRequest request,
HttpServletResponse response) {
requestHandler.dynamicInvocate(request);
Solution solution = requestHandler.getSolution();
return new ModelAndView(solution.getPage(),solution.getModelName(),solution.getModel());
public ModelAndView queryBook(HttpServletRequest request,
HttpServletResponse response) {
Book book = new Book();
BeanUtils.populate(book, request.getParameterMap());
Map&String,Object& map = new HashMap&String,Object&();
map.put(&book&, book);
requestHandler.dynamicInvocate(request, map);
Solution solution = requestHandler.getSolution();
return new ModelAndView(solution.getPage(),solution.getModelName(),solution.getModel());
对应的访问变成:
query.do?method=query&purpose=getBook&bookId=123;
query.do?method=queryBook&purpose=getBookList&bookName=JavaDesign&price=100;
query.do?method=query&purpose=getAuthorByBook&bookId=123;
这里IRequestHandler有两个版本的dynamicInvocate,第一个最为简单,就是从请求控制域获取参数然后执行调用,并最终返回一个Solution对象,这里面封装了模型和视图。而第二个版本,则可以实现更多的参数传递的调用。如一开始的代码清单(2)中,是没有办法直接从请求中获取Book对象的,这样构建一个Map传递给调用,也能成功的得到模型和视图。完成了这些,回过头来再次考虑刚才那个拥有30个节点的树,如果足够幸运,所有的查询都是从request,或者session中获取的参数,那么只有一个MultiActionController类文件,并且只有一个方法。值得一提的是这个requestHandler我们是使用方法注入的,也就是他始终是以原型的形式出现,不会造成一些负面的影响,在我们系统测试运行期间,他运作的很好,效果还算满意。
大家对这样的设计有何看法,欢迎大家讨论。
用手机扫描以上二维码直接访问此文。
系统分类:&>>&static&String
DEFAULT_COMMAND_NAME
&&&&&&&&&&Default command name used for binding command objects: "command"
static&String
LAST_MODIFIED_METHOD_SUFFIX
&&&&&&&&&&Suffix for last-modified methods
static&String
PAGE_NOT_FOUND_LOG_CATEGORY
&&&&&&&&&&Log category to use when no mapped handler is found for a request.
protected static&Log
pageNotFoundLogger
&&&&&&&&&&Additional logger to use when no mapped handler is found for a request.
METHOD_GET, METHOD_HEAD, METHOD_POST
MultiActionController()
&&&&&&&&&&Constructor for MultiActionController that looks for
handler methods in the present subclass.
MultiActionController(Object&delegate)
&&&&&&&&&&Constructor for MultiActionController that looks for
handler methods in delegate, rather than a subclass of this class.
protected &void
bind(HttpServletRequest&request,
Object&command)
&&&&&&&&&&Bind request parameters onto the given command bean
protected &ServletRequestDataBinder
createBinder(HttpServletRequest&request,
Object&command)
&&&&&&&&&&Create a new binder instance for the given command and request.
protected &String
getCommandName(Object&command)
&&&&&&&&&&Return the command name to use for the given command object.
protected &Method
getExceptionHandler(Throwable&exception)
&&&&&&&&&&Determine the exception handler method for the given exception.
getLastModified(HttpServletRequest&request)
&&&&&&&&&&Try to find an XXXXLastModified method, where XXXX is the name of a handler.
&MethodNameResolver
getMethodNameResolver()
&&&&&&&&&&Return the MethodNameResolver used by this class.
&Validator[]
getValidators()
&&&&&&&&&&Return the Validators for this controller.
&WebBindingInitializer
getWebBindingInitializer()
&&&&&&&&&&Return the WebBindingInitializer (if any) which will apply pre-configured
configuration to every DataBinder that this controller uses.
protected &ModelAndView
handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException&ex,
HttpServletRequest&request,
HttpServletResponse&response)
&&&&&&&&&&Handle the case where no request handler method was found.
protected &ModelAndView
handleRequestInternal(HttpServletRequest&request,
HttpServletResponse&response)
&&&&&&&&&&Determine a handler method and invoke it.
protected &void
initBinder(HttpServletRequest&request,
ServletRequestDataBinder&binder)
&&&&&&&&&&Initialize the given binder instance, for example with custom editors.
protected &void
initBinder(ServletRequest&request,
ServletRequestDataBinder&binder)
&&&&&&&&&&Deprecated.&as of Spring 2.0:
use initBinder(HttpServletRequest, ServletRequestDataBinder) instead
protected &ModelAndView
invokeNamedMethod(String&methodName,
HttpServletRequest&request,
HttpServletResponse&response)
&&&&&&&&&&Invokes the named method.
protected &Object
newCommandObject(Class&clazz)
&&&&&&&&&&Create a new command object of the given class.
setDelegate(Object&delegate)
&&&&&&&&&&Set the delegat the default is this,
assuming that handler methods have been added by a subclass.
setMethodNameResolver(MethodNameResolver&methodNameResolver)
&&&&&&&&&&Set the method name resolver that this class should use.
setValidators(Validator[]&validators)
&&&&&&&&&&Set the Validators for this controller.
setWebBindingInitializer(WebBindingInitializer&webBindingInitializer)
&&&&&&&&&&Specify a WebBindingInitializer which will apply pre-configured
configuration to every DataBinder that this controller uses.
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
LAST_MODIFIED_METHOD_SUFFIX
public static final String LAST_MODIFIED_METHOD_SUFFIX
Suffix for last-modified methods
See Also:Constant Field Values
DEFAULT_COMMAND_NAME
public static final String DEFAULT_COMMAND_NAME
Default command name used for binding command objects: "command"
See Also:Constant Field Values
PAGE_NOT_FOUND_LOG_CATEGORY
public static final String PAGE_NOT_FOUND_LOG_CATEGORY
Log category to use when no mapped handler is found for a request.
See Also:pageNotFoundLogger,
Constant Field Values
pageNotFoundLogger
protected static final Log pageNotFoundLogger
Additional logger to use when no mapped handler is found for a request.
See Also:PAGE_NOT_FOUND_LOG_CATEGORY
MultiActionController
public MultiActionController()
Constructor for MultiActionController that looks for
handler methods in the present subclass.
MultiActionController
public MultiActionController(Object&delegate)
Constructor for MultiActionController that looks for
handler methods in delegate, rather than a subclass of this class.
Parameters:delegate - handler object. This does not need to implement any
particular interface, as everything is done using reflection.
setDelegate
public final void setDelegate(Object&delegate)
Set the delegat the default is this,
assuming that handler methods have been added by a subclass.
This method does not get invoked once the class is configured.
Parameters:delegate - an object containing handler methods
IllegalStateException - if no handler methods are found
setMethodNameResolver
public final void setMethodNameResolver(MethodNameResolver&methodNameResolver)
Set the method name resolver that this class should use.
Allows parameterization of handler method mappings.
getMethodNameResolver
public final MethodNameResolver getMethodNameResolver()
Return the MethodNameResolver used by this class.
setValidators
public final void setValidators(Validator[]&validators)
Set the Validators for this controller.
The Validators must support the specified command class.
getValidators
public final Validator[] getValidators()
Return the Validators for this controller.
setWebBindingInitializer
public final void setWebBindingInitializer(WebBindingInitializer&webBindingInitializer)
Specify a WebBindingInitializer which will apply pre-configured
configuration to every DataBinder that this controller uses.
Allows for factoring out the entire binder configuration
to separate objects, as an alternative to initBinder(javax.servlet.http.HttpServletRequest, org.springframework.web.bind.ServletRequestDataBinder).
getWebBindingInitializer
public final WebBindingInitializer getWebBindingInitializer()
Return the WebBindingInitializer (if any) which will apply pre-configured
configuration to every DataBinder that this controller uses.
getLastModified
public long getLastModified(HttpServletRequest&request)
Try to find an XXXXLastModified method, where XXXX is the name of a handler.
Return -1 if there's no such handler, indicating that content must be updated.
Specified by:getLastModified in interface LastModified
Parameters:request - current HTTP request
Returns:the time the underlying resource was last modified, or -1
meaning that the content must always be regeneratedSee Also:LastModified.getLastModified(HttpServletRequest)
handleRequestInternal
protected ModelAndView handleRequestInternal(HttpServletRequest&request,
HttpServletResponse&response)
throws Exception
Determine a handler method and invoke it.
Specified by:handleRequestInternal in class AbstractController
ExceptionSee Also:MethodNameResolver.getHandlerMethodName(javax.servlet.http.HttpServletRequest),
invokeNamedMethod(java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse),
handleNoSuchRequestHandlingMethod(org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
handleNoSuchRequestHandlingMethod
protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException&ex,
HttpServletRequest&request,
HttpServletResponse&response)
throws Exception
Handle the case where no request handler method was found.
The default implementation logs a warning and sends an HTTP 404 error.
Alternatively, a fallback view could be chosen, or the
NoSuchRequestHandlingMethodException could be rethrown as-is.
Parameters:ex - the NoSuchRequestHandlingMethodException to be handledrequest - current HTTP requestresponse - current HTTP response
Returns:a ModelAndView to render, or null if handled directly
Exception - an Exception that should be thrown as result of the servlet request
invokeNamedMethod
protected final ModelAndView invokeNamedMethod(String&methodName,
HttpServletRequest&request,
HttpServletResponse&response)
throws Exception
Invokes the named method.
Uses a custom exception otherwise, throw an
wrap a checked exception or Throwable.
newCommandObject
protected Object newCommandObject(Class&clazz)
throws Exception
Create a new command object of the given class.
This implementation uses BeanUtils.instantiateClass,
so commands need to have public no-arg constructors.
Subclasses can override this implementation if desired.
Exception - if the command object could not be instantiatedSee Also:BeanUtils.instantiateClass(Class)
protected void bind(HttpServletRequest&request,
Object&command)
throws Exception
Bind request parameters onto the given command bean
Parameters:request - request from which parameters will be boundcommand - command object, that must be a JavaBean
Exception - in case of invalid state or arguments
createBinder
protected ServletRequestDataBinder createBinder(HttpServletRequest&request,
Object&command)
throws Exception
Create a new binder instance for the given command and request.
Called by bind. Can be overridden to plug in custom
ServletRequestDataBinder subclasses.
The default implementation creates a standard ServletRequestDataBinder,
and invokes initBinder. Note that initBinder
will not be invoked if you override this method!
Parameters:request - current HTTP requestcommand - the command to bind onto
Returns:the new binder instance
Exception - in case of invalid state or argumentsSee Also:bind(javax.servlet.http.HttpServletRequest, java.lang.Object),
initBinder(javax.servlet.http.HttpServletRequest, org.springframework.web.bind.ServletRequestDataBinder)
getCommandName
protected String getCommandName(Object&command)
Return the command name to use for the given command object.
Default is "command".
Parameters:command - the command object
Returns:the command name to useSee Also:DEFAULT_COMMAND_NAME
initBinder
protected void initBinder(HttpServletRequest&request,
ServletRequestDataBinder&binder)
throws Exception
Initialize the given binder instance, for example with custom editors.
Called by createBinder.
This method allows you to register custom editors for certain fields of your
command class. For instance, you will be able to transform Date objects into a
String pattern and back, in order to allow your JavaBeans to have Date properties
and still be able to set and display them in an HTML interface.
The default implementation is empty.
Note: the command object is not directly passed to this method, but it's available
via DataBinder.getTarget()
Parameters:request - current HTTP requestbinder - new binder instance
Exception - in case of invalid state or argumentsSee Also:createBinder(javax.servlet.http.HttpServletRequest, java.lang.Object),
DataBinder.registerCustomEditor(java.lang.Class, java.beans.PropertyEditor),
CustomDateEditor
initBinder
protected void initBinder(ServletRequest&request,
ServletRequestDataBinder&binder)
throws Exception
Deprecated.&as of Spring 2.0:
use initBinder(HttpServletRequest, ServletRequestDataBinder) instead
Initialize the given binder instance, for example with custom editors.
getExceptionHandler
protected Method getExceptionHandler(Throwable&exception)Determine the exception handler method for the given exception.Can return null if not found.Parameters:exception - the exception to handleReturns:a handler for the given exception type, or null
spring下的MultiActionController使用方法和示例
上一篇:下一篇:
责任申明:本站内容均整理自互联网,若有侵权,请联系我们。使用本站提供的任务技术内容造成不良后果,本站不负任何责任。
欢迎投稿,电子邮件:(#号换成@)&& QQ群1: &&

我要回帖

更多关于 易网贷年化收益 的文章

 

随机推荐