小编Ikt*_*der的帖子

如何使用JSF 2.0 Facelets在XHTML中包含另一个XHTML?

在XHTML页面中包含另一个XHTML页面的最正确方法是什么?我一直在尝试不同的方式,但都没有.

xhtml jsf facelets include jsf-2

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

Hibernate,spring,JPS和隔离 - 不支持自定义隔离

我一直在尝试这个:

@Transactional(isolation=Isolation.SERIALIZABLE, 
               rollbackFor={Exception.class}, 
               propagation=Propagation.REQUIRES_NEW)
Run Code Online (Sandbox Code Playgroud)

关于我的服务方法,但春天抱怨说:

Standard JPA does not support custom isolation levels - use a special JpaDialect
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

java database spring hibernate jpa

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

引用.war之外的configuration.properties

我想部署战争,战争应该从战争之外获取一些属性(假设.war文件在哪里,同一个目录.)

目前这是我找到的最佳解决方案:

<context:property-placeholder location="file:${user.home}/configuration.properties" ignore-unresolvable="true"/>
Run Code Online (Sandbox Code Playgroud)

但是这个解决方案迫使我把它永远保存在主目录中.我希望它在我部署我的.war的tomcat webapps目录中.我只是在寻找一个涉及绝对路径的解决方案.如果相对路径绝对不可能,那么我将考虑绝对路径.

提前致谢.

java xml spring datasource

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

java.lang.IllegalArgumentException:null source

我们有一个使用JSF2和Spring的应用程序.部署时应用程序正常运行.但如果我完成以下步骤,就会发生这种情况:

  1. 打开应用程序的登录页面.
  2. 在服务器上重新部署应用程序.
  3. 尝试使用以前打开的登录页面登录,它显示以下异常:

    javax.servlet.ServletException: null source
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
    
    root cause
    
    java.lang.IllegalArgumentException: null source
        at java.util.EventObject.<init>(EventObject.java:38)
        at javax.faces.event.SystemEvent.<init>(SystemEvent.java:67)
        at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:69)
        at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:69)
        at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:256)
        at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:245)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
        at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    
    Run Code Online (Sandbox Code Playgroud)

如果我单击第一个登录页面然后输入登录详细信息,则应用程序不会中断.只有当我尝试将以前加载的登录页面与新部署的应用程序一起使用时,才会出现这种情

谁知道答案?

jsf jsf-2

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

JSF selectOneMenu 正在刷新并返回到以前的状态,而不是显示新值

我有一个数据表,其中有很多 selectOneMenu 项目可用,例如,对于 10 个项目,每个项目都有一个 selectOneMenu 组合。现在,如果我单击任何组合,他们应该将值保存在数据库中,然后他们会这样做。但是在保存更改后的值后,selectOneMenu 将返回到之前的状态。我希望 selectOneMenu 保持其当前状态。此外,正在为数据表中的每个组合调用该方法。我真的想知道为什么!!过去 2 周我一直在敲我的头。任何帮助将非常感激。提前致谢。

这是我在这里的第一篇文章。这是我的 jsf 数据表:

<h:dataTable value="#{careNeedBean.controlledCareNeedsList}" var="careNeed"
        id="careneed_table" binding="#{careNeedBean.dataTable}">
<h:column>
 <f:facet name="header">
  <h:outputText value="NeedsLevel"/>
 </f:facet>
 <h:selectOneMenu id="needs_level_combo" style="width:200px;font-size:9px;"
                                         onchange="submit()" 
                                         valueChangeListener="#{careNeedBean.saveTaskAsessment}"
                                         binding="#{careNeedBean.selectOneMenu}">                                      
  <f:selectItem itemValue="not_assessed" itemLabel="----Not assessed----"/>
                    <f:selectItems value="#{careNeed.humanReadableNeedsList}" />
 </h:selectOneMenu>
</h:column>
Run Code Online (Sandbox Code Playgroud)

这是我的豆代码:

public String saveTaskAsessment(ValueChangeEvent event) {
   //does some things
   return "Success";
} 
Run Code Online (Sandbox Code Playgroud)

jsf selectonemenu valuechangelistener jsf-2

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

maven货物和硒

我使用maven货物和硒进行自动化.这是代码:

<plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.0.5</version>
            <configuration>
                <wait>false</wait>
                <container>
                    <containerId>tomcat6x</containerId>
                    <zipUrlInstaller>
                        <url>
                            http://mirrors.enquira.co.uk/apache/tomcat/tomcat-6/v6.0.30/bin/apache-tomcat-6.0.30.zip
                        </url>
                        <installDir>${installDir}</installDir>
                    </zipUrlInstaller>
                    <output>
                        ${project.build.directory}/tomcat6x.log
                    </output>
                    <log>${project.build.directory}/cargo.log</log>
                </container>
                <configuration>
                    <home>
                        ${project.build.directory}/tomcat6x/container
                    </home>
                    <properties>
                        <cargo.logging>high</cargo.logging>
                        <cargo.servlet.port>8081</cargo.servlet.port>
                    </properties>
                    <files>
                        <copy>
                          <file>${project.basedir}/src/main/resources/datasource.properties</file>
                          <todir>webapps</todir>
                          <configfile>true</configfile>
                          <overwrite>true</overwrite>
                        </copy>
                    </files>
                    <properties>
                       <customMessage>${catalina.home}</customMessage>
                    </properties>
                </configuration>
            </configuration>
            <executions>
                <execution>
                    <id>start-container</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>configure</goal>
                        <goal>start</goal>
                        <goal>deploy</goal>
                    </goals>
                    <configuration>
                        <deployer>
                            <deployables>
                                <deployable>
                                    <groupId>${project.groupId}</groupId>
                                    <artifactId>${project.artifactId}</artifactId>
                                    <type>war</type>
                                    <pingURL>**the url**</pingURL>
                                    <pingTimeout>180000</pingTimeout>
                                    <properties>
                                        <context>**war-name**</context>
                                    </properties>
                                </deployable>
                            </deployables>
                        </deployer>
                    </configuration>
                </execution>

                <execution>
                    <id>stop-container</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
Run Code Online (Sandbox Code Playgroud)

但随着战争开始变得越来越大,pingtimeout开始增加,我不想使用ping超时,但我现在被迫,因为部署需要一点时间,如果没有提到pingtimeout,selenium不会等待.

有没有解决这个问题的方法?

java selenium tomcat maven-2 maven-cargo

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

使用Hibernate本机查询插入不适用于java.util.Date

我正在使用Hibernate JPA和Spring与Mysql数据库,我想使用这样的SQL语句插入:

Date saveDate = new Date();
java.sql.Timestamp timeStampDate = new Timestamp(saveDate.getTime());
Query persistableQuery = entityManager.createNativeQuery("INSERT INTO TASK_ASSESSMENT (ACTIVE_FLAG, ASSESSMENT_DATE, DESCRIPTION, "
        + "TITLE, NEEDS_LEVEL_ID, PATIENT_ID, USER_ID) VALUES ("
        + true +", " + timeStampDate + ", " + description + ", " + title + ", "
        + needsLevelId + ", " + patientId + ", " + userId + " )");
persistableQuery.executeUpdate();
Run Code Online (Sandbox Code Playgroud)

但运行后我收到以下错误:

WARN : org.hibernate.util.JDBCExceptionReporter - SQL Error: -11, SQLState: 37000
ERROR: org.hibernate.util.JDBCExceptionReporter - Unexpected token: 15 …
Run Code Online (Sandbox Code Playgroud)

mysql sql spring hibernate jpa

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

maven ear plugin没有拿起application.xml

我正在使用jbosscc-seam-archtype 1.2,我将application.xml放在EAR项目中,/src/main/application/META-INF/但是maven-ear-plugin没有把它拿起来.有什么建议吗?

这是我的maven EAR插件的片段:

<plugins>
    <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
                <version>5</version>    
                <modules>
                    <webModule>
                        <groupId>com.***</groupId>
                        <artifactId>***-war</artifactId>
                        <contextRoot>***</contextRoot>
                        <unpack>${exploded.war.file}</unpack>
                    </webModule>

                    <jarModule>
                        <groupId>com.***</groupId>
                        <artifactId>***-datamodel</artifactId>
                        <includeInApplicationXml>true</includeInApplicationXml>
                    </jarModule>

                    <ejbModule>
                        <groupId>com.***</groupId>
                        <artifactId>***-bootstrap</artifactId>
                        <excluded>${exclude.bootstrap}</excluded>
                    </ejbModule>

                    <ejbModule>
                        <groupId>org.jboss.seam</groupId>
                        <artifactId>jboss-seam</artifactId>
                    </ejbModule>

                    <jarModule>
                        <groupId>org.jboss.el</groupId>
                        <artifactId>jboss-el</artifactId>
                        <bundleDir>lib</bundleDir>
                    </jarModule>

                </modules>

                <jboss>
                    <version>${version.jboss.app}</version>
                    <loader-repository>***:app=ejb3</loader-repository>
                </jboss>
            </configuration>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

maven-2 pom.xml seam2 maven-ear-plugin

5
推荐指数
2
解决办法
9702
查看次数

liquibase使用maven和两个数据库

我有以下结构从maven运行一个数据库:

<plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-plugin</artifactId>
            <version>1.9.5.0</version>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <configuration>
                        <changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
                        <driver>com.mysql.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/charm</url>  
                        <username>***</username>
                        <password>***</password>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

现在我想在名为charm2的同一服务器上运行另一个数据库.我试过这个:

<plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-plugin</artifactId>
            <version>1.9.5.0</version>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <configuration>
                        <changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
                        <driver>com.mysql.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/charm</url>  
                        <username>***</username>
                        <password>***</password>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
                <execution>
                    <phase>process-resources</phase>
                    <configuration>
                        <changeLogFile>src/main/resources/db.changelog.xml</changeLogFile>
                        <driver>com.mysql.jdbc.Driver</driver>
                        <url>jdbc:mysql://localhost:3306/charm2</url>  
                        <username>***</username>
                        <password>***</password>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

它不起作用.有谁知道如何解决这个问题?

database maven-2 liquibase

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

上次运行的 tomcat 类仍然存在

我正在运行一个使用 spring、hibernate、jsf 等的应用程序。该应用程序还使用 ha-jdbc 来使数据库高度可用。应用第一次部署时,应用运行流畅,但是当它取消部署并部署回来时,tomcat给出以下错误:

以下 Web 应用程序已停止(重新加载、取消部署),但它们之前运行的类仍在内存中加载,从而导致内存泄漏(使用分析器确认):

我想知道如何摆脱这个问题。任何天才?

提前致谢。

java high-availability tomcat6

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

Facelets中的Spring安全注销链接

我以前有JSP实现Spring安全注销,如下所示:

<a id="logout" href="<spring:url value="/j_spring_security_logout" htmlEscape="true" />">Logout</a>
Run Code Online (Sandbox Code Playgroud)

后来当我改为jsf 2并开始使用Facelets时,我再也无法让它工作了.我尝试了很多方法.我试过这个:

<a id="logout" href="&lt;spring:url value=&quot;/j_spring_security_logout&quot; htmlEscape=&quot;true&quot; &sol;&gt;">Logout</a>
Run Code Online (Sandbox Code Playgroud)

但它不会工作.有人可以帮帮我吗?我非常感谢你的帮助.

java jsf facelets spring-security jsf-2

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