Spring mvc show,在tipo=?,

Spring mvc show,在tipo=?,,spring-mvc,crud,derby,jdbctemplate,Spring Mvc,Crud,Derby,Jdbctemplate,这两件事不相匹配,这是非常令人困惑的 但是我相信这两个都是错误的。在每个列=?表达式之间应该有一个逗号,在where前面的最后一列后面应该没有逗号 我相信如果你仔细检查你的程序,看看你的update语句中逗号的位置,你会发现问题所在。请将你的问题标题改为有意义的内容。您所做的只是重复标签中已有的信息。你的标题应该描述一个问题或提出一个问题的方式,这将有一些意义的未来读者在这里看到的搜索结果列表。重复标签信息是毫无意义和无用的。请花些时间阅读这些页面,尤其是。 package Controller

这两件事不相匹配,这是非常令人困惑的

但是我相信这两个都是错误的。在每个
列=?
表达式之间应该有一个逗号,在
where
前面的最后一列后面应该没有逗号

我相信如果你仔细检查你的程序,看看你的
update
语句中逗号的位置,你会发现问题所在。

请将你的问题标题改为有意义的内容。您所做的只是重复标签中已有的信息。你的标题应该描述一个问题或提出一个问题的方式,这将有一些意义的未来读者在这里看到的搜索结果列表。重复标签信息是毫无意义和无用的。请花些时间阅读这些页面,尤其是。
package Controller;

import Modelo.Conectar;
import Modelo.Fabricante;
import Modelo.FabricanteValidar;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.ResultSetExtractor;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.servlet.ModelAndView;

/**
*
* @author x2010s
*/

@Controller
@RequestMapping("fabricanteedit.htm")
public class FabricanteEditController {

FabricanteValidar fabricanteValidar;
private JdbcTemplate jdbcTemplate;

public FabricanteEditController() 
{
   this.fabricanteValidar=new FabricanteValidar();
   Conectar con=new Conectar();
   this.jdbcTemplate=new JdbcTemplate(con.conectar() );
}

@RequestMapping(method=RequestMethod.GET) 
public ModelAndView form(HttpServletRequest request)
{
    ModelAndView mav=new ModelAndView();
    int id=Integer.parseInt(request.getParameter("id"));
    Fabricante datos=this.selectFabricante(id);
    mav.setViewName("fabricanteedit");
    mav.addObject("fabricante",new  Fabricante(id,datos.getNombre(),datos.getDireccion(),datos.getTelefono(),datos.getTipo()));
    return mav;
}

 @RequestMapping(method=RequestMethod.POST)
 public ModelAndView form
    (
            @ModelAttribute("fabricante") Fabricante f,
            BindingResult result,
            SessionStatus status,
            HttpServletRequest request
    )
{
 this.fabricanteValidar.validate(f, result);
    if(result.hasErrors())
    {
         ModelAndView mav=new ModelAndView();
        int id=Integer.parseInt(request.getParameter("id"));
        Fabricante datos=this.selectFabricante(id);
        mav.setViewName("fabricanteedit");
        mav.addObject("fabricante",new Fabricante(id,datos.getNombre(),datos.getDireccion(),datos.getTelefono(),datos.getTipo()));
        return mav;
    }else
    {
        int id=Integer.parseInt(request.getParameter("id"));
    this.jdbcTemplate.update(
                "update fabricante "
            + "set nombre=?,"
            + "direccion=?,"
            + "telefono=? "
            + "tipo=? "
            + "where "
            + "id=? ",
     f.getNombre(),f.getDireccion(),f.getTelefono(),f.getTipo(),id);
     return new ModelAndView("redirect:/fabricante.htm");
    }   

}
    public Fabricante selectFabricante(int id) 
{
    final Fabricante maker = new Fabricante();
    String quer = "SELECT * FROM fabricante WHERE id="+id;
    return (Fabricante) jdbcTemplate.query
    (
            quer, new ResultSetExtractor<Fabricante>() 
        {
            public Fabricante extractData(ResultSet rs) throws SQLException, DataAccessException {
                if (rs.next()) {
                    maker.setNombre(rs.getString("nombre"));
                    maker.setDireccion(rs.getString("direccion"));
                    maker.setTelefono(rs.getString("telefono"));
                    maker.setTipo(rs.getString("tipo"));

                }
                return maker;
            }


        }
    );
    }
}
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"   %>
<%@taglib  prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Editar Fabricante</title>
    <link href="css/estilos.css" rel="stylesheet">
    <link href="css/bootstrap.min.css" rel="stylesheet" >
</head>
<body>
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="<c:url value="/fabricante.htm" />">Listado de  fabricante</a></li>
            <li class="active">Editar</li>
        </ol>
        <div class="panel panel-primary">
            <div class="panel-heading">Editar</div>
            <div class="panel-body">

                    <form:form method="post" commandName="fabricante">
                        <h1>Complete el formulario</h1>

                        <form:errors path="*" element="div"  cssClass="alert alert-danger" />

                       <p>
                            <form:label path="nombre">Nombre:  </form:label>
                            <form:input path="nombre" cssClass="form-control" />

                        </p>

                        <p>
                            <form:label  path="direccion">Direccion</form:label>
                            <form:input path="direccion" cssClass="form-control" />
                        </p>

                        <p>
                            <form:label path="telefono">Telefono</form:label>
                            <form:input path="telefono" cssClass="form-control" />
                        </p>

                        <p>
                            <form:label path="tipo">Tipo</form:label>
                            <form:input path="tipo" cssClass="form-control" />
                        </p>

                        <hr />
                        <input type="submit" value="Enviar" class="btn btn-danger" />
                    </form:form>
              </div>
          </div>
      </div>
  </body>
    this.jdbcTemplate.update(
            "update fabricante "
        + "set nombre=?,"
        + "direccion=?,"
        + "telefono=? "
        + "tipo=? "
        + "where "
        + "id=? ",
bad SQL grammar [update fabricante set nombre=?,direccion=?,telefono=?, tipo=?, where id=? ];