小编Oli*_* J.的帖子

在CSS渲染后调用JQuery函数

当我使用时$(document).ready(function() {...},在DOM准备好之后调用该函数,但是(我认为)在加载CSS样式之前.

我想检索元素的宽度,但是当我尝试在ready()事件中检索它时,返回的值与CSS值不匹配.但是,当我使用计时器在10秒后调用此函数时,它按预期工作.

那么,有没有办法用jQuery监听CSS渲染?

谢谢

css jquery

3
推荐指数
1
解决办法
2304
查看次数

JPA 和枚举类型

我为 JPA 实体使用枚举类型的一个字段:

@Enumerated(value=EnumType.STRING)
private Temperament temperament = Temperament.MINEUR_PUR;
Run Code Online (Sandbox Code Playgroud)

我的枚举在我的实体中声明:

@Entity
public class Joueur implements Serializable {

.....

    public enum Temperament{
        MINEUR_PUR(30),
        MINEUR(10),
        NEUTRE(0),
        RAIDEUR(-10),
        RAIDEUR_PUR(-30);

        private int temperament_prod_mines;

        private Temperament(int temperament_prod_mines){
            this.temperament_prod_mines = temperament_prod_mines;       
        }

        public int getTemperament_prod_mines() {
            return temperament_prod_mines;
        }

        public void setTemperament_prod_mines(int temperament_prod_mines) {
            this.temperament_prod_mines = temperament_prod_mines;
        }
    }   
}
Run Code Online (Sandbox Code Playgroud)

它可以工作,但是当我在它自己的文件中“外部化”我的枚举时,它不再起作用:

引起:异常 [EclipseLink-7151] (Eclipse Persistence Services - 2.3.2.v20111125-r10461):org.eclipse.persistence.exceptions.ValidationException 异常描述:类型 [class com.sim.basics.enums.Temperament]实体类 [class com.sim.entities.Joueur] 上的属性 [temperament] 不是枚举映射的有效类型。该属性必须定义为 Java 枚举。

但这只是复制/粘贴...

为什么会有这种行为?

谢谢

java caching jpa

3
推荐指数
1
解决办法
2473
查看次数

JSF,validateRegex和&(&符号)

我想测试inputText字段,看看它的内容是否匹配任何东西,但至少有一个&(&符号).

当我测试&\&\\&validateRegex的内侧的图案场,我总是收到此错误:

javax.faces.view.facelets.FaceletException:错误解析/index.xhtml:错误跟踪[line:71] Le nom de l'identitédoitimmédiatementuivrelecaractère"&"danslaréférenced'engeé.

我得到500错误......

我怎么能逃脱这个角色?


更新

我测试过了

<p:inputText id="player_name_register" value="#{login.name}">
    <f:validateRegex pattern="[&amp;]{3, 50}" />
</p:inputText>
Run Code Online (Sandbox Code Playgroud)

但是当我用&&&&&&它测试时它不起作用.

我也测试过

<![CDATA[
    <p:inputText id="player_name_register" value="#{login.name}">
        <f:validateRegex pattern="[&amp;]{3, 50}" />
    </p:inputText>
]]>
Run Code Online (Sandbox Code Playgroud)

但我的inputText不再出现了.

java regex jsf

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

Flex与BitmapImage之间的差异?

Image'sddoc中,我们可以看到:

Flex还包括BitmapImage类.此类用于将图像嵌入到外观和FXG组件中

但我们也可以Image在皮肤中使用@Embed并与Image...一起使用

因此,我应该在何时何地使用ImageBitmapImage取悦?

apache-flex

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

Maven和maven-resources-plugin

我想使用maven-resources-plugin将资源复制到另一个目录.

我的资源目录具有以下结构:

log4j.xml
xml
  |_ resource-1
  |_ resource-n
Run Code Online (Sandbox Code Playgroud)

我想只将log4.xml复制到输出目录.这是我的插件代码:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <outputDirectory>${glassfish.conf}</outputDirectory>
            <resources>
                <resource>
                    <directory>${conf.location}</directory>
                    <includes>
                        <include>**/log4j.xml</include>
                    </includes>
                    <excludes>
                        <exclude>**/xml/*</exclude>
                    </excludes>
                </resource>
            </resources>
        </configuration>
        <executions>
            <execution>
                <id>copy-log4j-to-glassfish</id>
                <phase>package</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
            </execution>
        </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

但是所有都被复制到输出目录(log4j.xml和xml目录).

我试过了

<resource>
    <directory>${conf.location}</directory>
        <excludes>
            <exclude>**/xml/*</exclude>
        </excludes>
</resource>
Run Code Online (Sandbox Code Playgroud)

要么

<resource>
    <directory>${conf.location}</directory>
    <includes>
        <include>**/log4j.xml</include>
    </includes>                         
</resource>
Run Code Online (Sandbox Code Playgroud)

甚至

<resource>
    <directory>${conf.location}</directory>
    <excludes>
        <exclude>**/*</exclude>
    </excludes>
</resource>
Run Code Online (Sandbox Code Playgroud)

但目录的所有内容都包含在内......问题是什么?

谢谢

maven

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

Java和参考

我有基础课:

 public class SomeClass {

    private List<String> list = new ArrayList<String>();

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }   

}
Run Code Online (Sandbox Code Playgroud)

在方法中我有这个代码:

private void test(){

    SomeClass sc1 = new SomeClass();
    sc1.getList().add("a");
    sc1.getList().add("b");

    SomeClass sc2 = sc1;

    System.out.println(sc2.getList().size());

    sc1.getList().remove(0);
    System.out.println(sc2.getList().size());

    sc1=null;
    System.out.println(sc2.getList().size());

    sc2=null;
    System.out.println(sc2.getList().size());


}
Run Code Online (Sandbox Code Playgroud)

我收到 :

  • 2
  • 1
  • 1
  • 空指针异常

但我会收到:

  • 2
  • 1
  • 空指针异常
  • NullPointerException(如果先前捕获了NullPointerException)

如果引用的对象设置为null,参考链接会被破坏?谢谢你的澄清

java

0
推荐指数
2
解决办法
103
查看次数

标签 统计

java ×3

apache-flex ×1

caching ×1

css ×1

jpa ×1

jquery ×1

jsf ×1

maven ×1

regex ×1