Java – Method getbuild() does not define type mvcuricomponentsbuilder MethodArgumentBuilder
•
Java
The problem of building URIs for controllers and methods from views
@Controller @RequestMapping("/produtos") public class ProductsController { @Autowired private ProductDAO productDAO; @Transactional @RequestMapping(method=RequestMethod.POST) public ModelAndView save(Product product){ productDAO.save(product); return new ModelAndView("redirect:produtos"); }
And my JSP
<form:form action="${spring:mvcUrl('PC#save').build()}" method="post" >
I encountered an error on JSP:
Method getbuild() does not define type mvcuricomponentsbuilder MethodArgumentBuilder
If I use grammar http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc -ann-requestmapping-uri-templates:
<form:form action="${spring:mvcUrl(''PC#save'').build()}" method="post" >
There seems to be no error on the JSP, but in the Web:
org.apache.jasper.JasperException: /WEB-INF/views/products/form.jsp (line: 20,column: 1) "${spring:mvcUrl(''PC#save'').build()}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${spring:mvcUrl(''PC#save'').build()}] org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:275) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:91) org.apache.jasper.compiler.Validator$ValidateVisitor.getJspAttribute(Validator.java:1422) org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1231) org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:879) org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1536) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434) org.apache.jasper.compiler.Node$Root.accept(Node.java:464) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376) org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1853) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217) org.apache.jasper.compiler.Compiler.compile(Compiler.java:356) org.apache.jasper.compiler.Compiler.compile(Compiler.java:336) org.apache.jasper.compiler.Compiler.compile(Compiler.java:323) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:172) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1228) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) javax.servlet.http.HttpServlet.service(HttpServlet.java:622) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
I also tried to remove JSP errors on eclipse
Solution
Add a taglib <% @ taglib URI=“ http://www.springframework.org/tags ”prefix =“spring”%>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码