我在运行我的应用程序时收到以下信息:
The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
Run Code Online (Sandbox Code Playgroud)
我想知道这种错误的原因是什么?
我有一个映射到Long属性的输入文本.
private Long length;
Run Code Online (Sandbox Code Playgroud)
<h:inputText value="#{bean.length}" />
Run Code Online (Sandbox Code Playgroud)
当我在输入文本中输入非数字时,我收到以下转换错误:
myForm:myField:'someText'必须是由一个或多个数字组成的数字.
我想知道如何自定义此消息:
长度必须是大于零的数字.
在我的web.xml中,我想从属性文件中读取欢迎文件,例如:
<welcome-file-list>
<welcome-file>${home.page}</welcome-file>
</welcome-file-list>
Run Code Online (Sandbox Code Playgroud)
我有propertyPlaceholderConfigurer配置:
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:messages/application.properties</value>
</list>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
应该在web.xml中添加额外的参数,还是需要定义另一个bean或者是什么?
另外我在web.xml的同一级别上有另一个xml文件(在WEB-INF direclty下)我能以同样的方式从属性文件中读取吗?
请指教.
我正在使用JSF 2.1.4和facelets ,一切正常,但我的模板突然没有任何变化,我一直收到错误:
javax.faces.view.facelets.TagAttributeException: /pages/template/commonLayout.xhtml @35,59 <ui:include src="/pages/template/commonHeader.xhtml"> Invalid path : /pages/template/commonHeader.xhtml
at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:125)
at com.sun.faces.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:113)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137)
at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:184)
at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:98)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:308)
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:367)
at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:346)
at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:155)
at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:86)
at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:152)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:773)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
at …Run Code Online (Sandbox Code Playgroud) 我想知道是否有一个Primefaces eclipse设计师已经发布或预计很快就会发布,谢谢.
我有三个实体:
- 权限,权限,PermissionCategory
- Desc:权限可以包含许多权限,权限可以在许多权限中,permissionCategory可以包含许多权限.
1-委会> 多对多随着权限
class Authority{
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "authority_permission", joinColumns = { @JoinColumn(name = "authority_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "permission_id", nullable = false, updatable = false) })
private Set<Permission> permissions = new HashSet<Permission>(0);
}
Run Code Online (Sandbox Code Playgroud)
2- PermissionCategory> 一对多随着许可
class PermissionCategory{
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name = "perm_cat_map", joinColumns = { @JoinColumn(name = "perm_cat_id") }, inverseJoinColumns = …Run Code Online (Sandbox Code Playgroud) 他我在独立应用程序中使用spring进行依赖注入,MessageSource和PropertyPlaceHolder支持,Hibernate/JDBC支持,单元测试,我想知道上述要求所需的最小罐子是什么,如果我可以排除一些罐子或依赖关系形式我目前的配置,因为我不需要应用程序大小,因为它是一个独立的应用程序,我需要尽可能小的应用程序大小,这是我现在使用的依赖项:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId> …Run Code Online (Sandbox Code Playgroud) 我得到了关于如何在OOP中代表一个动物园的这个采访问题,我的回答是动物园将拥有属性集动物,其中Animal是一个抽象类,动物园里的所有动物都会扩展它,它将包含物种,城市属性.和Zoo将扩展抽象类Agricultural_land,其中包含空间,地点属性.
我得到一个问题,如果我有不同类型的鸟类,如何在OOP中代表它们,我说我将为鸟类制作另一个类别,不同类型的鸟类将扩展它.
请把你的想法告诉我.
我为登录页面做了一个成功的selenium测试用例,用户输入正确的用户名和密码然后点击登录转发到主页,问题是当我在测试类中更改密码时,测试总是成功我不要我知道为什么.
这是测试类:
public class LoginTest extends TestCase {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://localhost:8080";
}
@Test
public void testLoginClass() throws Exception {
driver.get(baseUrl + "/MyAPP/login");
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.findElement(By.id("j_username")).clear();
driver.findElement(By.id("j_username")).sendKeys("1");
driver.findElement(By.id("j_password")).clear();
driver.findElement(By.id("j_password")).sendKeys("wrong password");
driver.findElement(By.id("loginBtn")).click();
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
@SuppressWarnings("unused")
private …Run Code Online (Sandbox Code Playgroud) 我试图从环境变量加载属性文件,所以这是我试过的:
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:messages/application.properties</value>
<value>file:${My_ENV_VAR}/*.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="true" />
<property name="searchSystemEnvironment" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
</bean>
Run Code Online (Sandbox Code Playgroud)
我有一个新的环境变量命名,My_ENV_VAR=C:\Program Files\My Folder\props.properties
但在停止和启动应用程序时,没有设置变量的值,任何想法为什么?
更新:要求
我想从文件系统上的外部属性文件中读取applicationContext.xml中的hibernate属性(url,username,password),其路径存储在环境变量中.