发现SpringMVC批量删除的时候只需要删除id属性即可。然后参数用 List<Integer> 封装起来。就可以在这个集合中找到这些id了。
现在发现批量更新的时候 List<MyClass> 用我自己的类的时候发现得不到数据。- -..
谁做过SpringMVC的批量更新的
教授一下 

解决方案 »

  1.   

    springmvc 要批量更新调用的也是dao 层操作
    我用的springmvc ibatis ,得到批量的数据id组装成string,最终都是为了在批量的sql里面 做成这种格式
    updage *******  where id in (1,2,3)
    至于你用什么格式接收controller 得到的ids, 最终的格式是分开成单个id
      

  2.   

    spring的jdbc封装吗?
    例子:public class JdbcActorDao implements ActorDao {
        private JdbcTemplate jdbcTemplate;    public void setDataSource(DataSource dataSource) {
            this.jdbcTemplate = new JdbcTemplate(dataSource);
        }    public int[] batchUpdate(final List actors) {
            int[] updateCounts = jdbcTemplate.batchUpdate(
                    "update t_actor set first_name = ?, last_name = ? where id = ?",
                    new BatchPreparedStatementSetter() {
                        public void setValues(PreparedStatement ps, int i) throws SQLException {
                            ps.setString(1, ((Actor)actors.get(i)).getFirstName());
                            ps.setString(2, ((Actor)actors.get(i)).getLastName());
                            ps.setLong(3, ((Actor)actors.get(i)).getId().longValue());
                        }                    public int getBatchSize() {
                            return actors.size();
                        }
                    } );
            return updateCounts;
        }    //  ... additional methods
    }