Neither Bindingresult nor plain target object for bean

Source: Internet
Author: User

When you develop a project, if you choose the Spring MVC Framework, and you use the spring label in the foreground, then you are likely to appear in this situation.

Javax.servlet.jsp.JspTagException:Neither Bindingresult nor plain target object for Bean name ' command ' available as requ EST attribute

Method: 1 Throws an exception cause, 2 is the exception workaround.

1. Reason: Enter the spring:bind tag source code you can see

Object target = Requestcontext.getmodelobject (beanname);
if (target = = null) {
throw new IllegalStateException ("Neither Bindingresult nor plain target object for Bean name '" +
Beanname + "' Available as request attribute");
}

Beanname= <spring:bind path= "COMMAND.SPJG" > Green section

If you are making a request directly to a page, the object is not command in request

2.

On the page, add

<jsp:usebean id= "command" class= "Com.ztenc.proj.bean.AFRFOAP" scope= "Request" ></jsp:useBean>

The red part fills in your binding class

PS: Although unknown, but feel Li ~

The above content is reproduced, followed by my own original solution:

At the controller place. Plus:

@ModelAttribute
Public Product Get (@RequestParam (required=false) Long ID) {
return id==null?new Product ():p roductservice.findone (ID);
}

Everything OK

Neither Bindingresult nor plain target object for bean

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.