2016年

使用Spring mvc接收整个url地址及参数时注意事项:
url= http://baidu?oid=9525c1f2b2cd45019b30a37bead6ebbb&td=2015-08-22&ot=a31f30c7905b4c8cb663e4d93de285c8
@RequestMapping(value="/aa",method=RequestMethod.GET)
public ModelAndView aa(HttpServletRequest request,String url){
ModelAndView mav = new ModelAndView("redirect:"+url);
return mav;
}
这样到controller里面后,url中&符号后面的参数会都丢失。
使用encodeURIComponent(url); 在controller中就获得这个正确的地址。

阿里巴巴的datasource:
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">

结合使用spring的jdbcTemplate
@Autowired
DruidDataSource dataSource;

jdbcTemplate = new JdbcTemplate(dataSource);
int rowCount = this.jdbcTemplate.queryForObject("select count(*) from price_base", Integer.class);

当前也可以使用spring的JdbcDaoSupport
具体参考:http://www.mkyong.com/spring/spring-jdbctemplate-jdbcdaosupport-examples/

免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。