小编Rub*_*zzo的帖子

在jQuery中,focusin/focusout与focus/blur有什么区别?

我使用以下代码使用jQuery 1.7.2处理一些事件:

$().on('focus blur', function(event) {
  console.log(event.type);
});
Run Code Online (Sandbox Code Playgroud)

而且我注意到,event.type对于这两个事件,打印出来:focusinfocusout.

focusin/focusoutvs 之间有什么区别focus/blur

javascript jquery

9
推荐指数
1
解决办法
1万
查看次数

Spring Security并发控制

我使用了spring security 3.0.7,我在我的项目中实现了并发控制.但它没有用.我用过

<security:session-management>
            <security:concurrency-control error-if-maximum-exceeded="true" max-sessions="1"/>
</security:session-management>
Run Code Online (Sandbox Code Playgroud)

即使我尝试过弹簧安全参考的解决方案,但它没有成功.这是我的配置文件内容:

  <session-management session-authentication-strategy-ref="sas"/>
</http>

<beans:bean id="concurrencyFilter"
   class="org.springframework.security.web.session.ConcurrentSessionFilter">
  <beans:property name="sessionRegistry" ref="sessionRegistry" />
  <beans:property name="expiredUrl" value="/session-expired.htm" />
</beans:bean>

<beans:bean id="myAuthFilter" class=
   "org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
  <beans:property name="sessionAuthenticationStrategy" ref="sas" />
  <beans:property name="authenticationManager" ref="authenticationManager" />
</beans:bean>

<beans:bean id="sas" class=
 "org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy">
  <beans:constructor-arg name="sessionRegistry" ref="sessionRegistry" />
  <beans:property name="maximumSessions" value="1" />
</beans:bean>

<beans:bean id="sessionRegistry"
    class="org.springframework.security.core.session.SessionRegistryImpl" />
Run Code Online (Sandbox Code Playgroud)

我得到以下异常:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Filter beans '<myAuthFilter>' and '<org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0>' have the same 'order' value. When using custom filters, please make sure the positions do …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

8
推荐指数
1
解决办法
2万
查看次数

如何在Laravel中自定义验证消息?

在问这个问题之前我经常搜索,但没有找到任何帮助我.我开始使用Laravel作为PHP框架.当我开始进行表单验证时,我使用Validator该类来管理所有验证和错误消息.但我想知道如何自定义错误消息(例如我想用另一种语言).

validation laravel

8
推荐指数
2
解决办法
8136
查看次数

如何在jQuery中获取`form.field.value`?

在javascript我可以验证提交表格如下: -

<form action="" method="post" onsubmit="return validate(this)">
    <input type="text" name="uName" id="uName" />
    <input type="password" name="passKey" id="passKey" />
    <input type="submit" name="loginBtn" value="login" />
</form>

<script type="text/javascript">
function validate(loginForm){
    if(loginForm.uName.value == ''){
        alert('Please Enter Username');
        loginForm.uName.focus();
    }else if(loginForm.passKey.value == ''){
        alert('Please Enter Password');
        loginForm.passKey.focus();
    }else {
        return true;
    }
}
</script>
Run Code Online (Sandbox Code Playgroud)

我试过下面的jQuery代码

<form action="" method="post">
    <input type="text" name="uName" id="uName" />
    <input type="password" name="passKey" id="passKey" />
    <input type="submit" name="loginBtn" value="login" />
</form>
<script type="text/javascript">
    $('form').submit(function(loginForm){
        if(loginForm.uName.val() == ''){
            alert('Please enter username');
            loginForm.uName.focus();
        }else …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

8
推荐指数
1
解决办法
4万
查看次数

Maven中的集成Tomcat重新加载源?

我使用maven进行web应用程序来构建,启动和处理库.所以我运行tomcat7:运行来开发我的应用程序......但是如果我更改代码,tomcat将不会自动重新加载代码更改,所以我需要重新启动.在maven之前,我使用"Sysdeo Eclipse Tomcat Launcher插件"来运行和创建我的项目.这个插件允许即时查看代码更改,我知道播放!框架也是如此.那么有可能将maven配置为在运行时重新加载我的代码更改吗?我会改善我的工作进度......

java tomcat maven

8
推荐指数
1
解决办法
3732
查看次数

Laravel日志记录:日志行末尾的额外方括号?

我对Laravel很新,我注意到当我使用基于Monolog的日志记录时,例如Log::info('blah blah'),它写入我的日志文件的行后缀有两组空方括号.它们是什么,我怎么能把它们关掉?他们丝毫没有帮助.我已经尝试深入挖掘源代码和谷歌搜索,但我没有看到任何解释.

例:

[2013-11-12 09:13:16] log.INFO:Hello world [] []

[2013-11-12 09:13:31] log.INFO:我的愚蠢日志消息[] []

谢谢!

php monolog laravel-4

8
推荐指数
2
解决办法
3325
查看次数

如何让Maven 2构建2个单独的WAR文件

在做的时候,mvn install我想在目标目录中得到2个WAR文件.一个将包含生产 web.xml,另一个将包含test/uat web.xml.

我试过这个:

<build>
    <finalName>cas-server</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1-beta-1</version>
            <configuration>
                <webXml>src/main/config/prod/web.xml</webXml>
                <warName>cas-prod</warName>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1-beta-1</version>
            <configuration>
                <webXml>src/main/config/test/web.xml</webXml>
                <warName>cas-test</warName>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

但我最终只得到测试WAR.

java maven-2

7
推荐指数
2
解决办法
2万
查看次数

hibernate @ManyToMany双向渴望获取

我有一个问题,我觉得应该很常见,但我找不到答案.

我有2个对象:组和用户.我的课看起来像这样:

class Group
{
  @ManyToMany(fetch = FetchType.EAGER)
  List<User> users;
}

class User
{
  @ManyToMany(fetch = FetchType.EAGER)
  List<Group> groups;
}
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试从数据库中获取用户时,它会带来所有组,所有组都会带来所有用户等等.最后,我得到了一个stackoverflow异常.

如何解决此问题并仍然具有双向关联以及到达列表中对象的能力?

many-to-many hibernate fetch

7
推荐指数
1
解决办法
1万
查看次数

MySQL错误:无法从您的IP地址获取主机名

我很长时间使用我的远程MySQL数据库.

但今天我突然发现我无法连接到数据库.我有一个错误.

"无法从您的IP地址获取主机名".

我在MySQL设置中没有改变任何东西.

有什么问题?

mysql ip hostname

7
推荐指数
1
解决办法
5万
查看次数

@Transactional会在Spring 3中自动回滚事务吗?

我正在作为单元测试运行,即使我不使用@rollback弹簧3.1 ,它也会自动返回.我的测试看起来像

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:application-context.xml" })
public class PersonServiceTest {

    @Test
    @Transactional
    public void savePerson() {
            Person person = createPerson();
            personService.savePerson(person);
    }
}
Run Code Online (Sandbox Code Playgroud)

是否默认设置回滚行为?

spring unit-testing transactions

7
推荐指数
1
解决办法
2634
查看次数