我想在当前日期添加一天,这是我的代码:
var dt = $filter('date')(new Date(), "yyyy-MM-dd");
alert(dt);
dt.setDate(dt.getDate() + 1);
alert("date plus one day is : "+dt);
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误:
类型错误:dt.getDate 不是函数
有人可以帮忙吗?
如何获得跟随光标的工具提示。我的工具提示出现在右下角。只出现了一部分:
这是代码:
$(document).ready(function(e)
{
// By suppling no content attribute, the library uses each elements title attribute by default
$('#visualization').qtip({
// Simply use an HTML img tag within the HTML string
content: 'i am a qtip'
});
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的项目中使用Spring Security,这里是代码:
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// TODO Auto-generated method stub
//super.configure(auth);
//auth.inMemoryAuthentication().withUser("admin").password("1111").roles("USER");
auth
.jdbcAuthentication()
.dataSource(dataSource)
.usersByUsernameQuery("select username, password, 1 from users where username=?")
.authoritiesByUsernameQuery("select users_username, roles_id from roles_users where users_username=?")
.rolePrefix("ROLE_");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable();
http
.httpBasic();
http
.authorizeRequests()
.anyRequest().authenticated();
http
.authorizeRequests()
.antMatchers("/users/all").hasRole("admin")
.and()
.formLogin();
http
.exceptionHandling().accessDeniedPage("/403");
}
Run Code Online (Sandbox Code Playgroud)
这是问题所在:
想象一下,我们的数据库中有两个用户(一个有user角色,另一个有admin角色),一个是admin,第二个是用户,问题是我作为用户连接时(只有user角色)可以访问管理员资源(这不是预期的行为).
我认为这个查询中的问题:
"select username, password, 1 from users where username=?"
Run Code Online (Sandbox Code Playgroud)
据说那username是主键? …