here is the thing
ps = conn.prepareStatement("INSERT INTO goods_country(goodsId,goodsCountry) VALUES (?,?)");
ps.setInt(1, this.returnId());
ps.setString(2, goodsCountry);
int exe = ps.executeUpdate();
Im sure that this.returnId()
and goodsCountry
has value,
when run this code that occur this error
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860) at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3321) at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3306) at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3345) at com.mysql.jdbc.PreparedStatement.setInt(PreparedStatement.java:3296) at com.backend.model.MoviesBeanBO.inserCountry(MoviesBeanBO.java:67) at com.backend.controller.MovieOnBoard.doPost(MovieOnBoard.java:71) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:25)
can't figure it out what happened, if somebody can help ,I would be very appreciate. thx!