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