小编Pet*_*zov的帖子

禁用Web浏览器密码保存

我有一个使用JSF 2.0制作的简单登录页面.通常在每个登录页面中,Web浏览器建议用户将其用户名保存为密码.

我在Oracle的网站上看到用户必须验证当我输入用户名和密码时,浏览器不会问我是否要保存用户名和密码.也许有一种方法可以从登录页面的代码中禁用它.

这可能吗?

jsf jboss jsf-2

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

如何使用JSF获取用户的浏览器ID?

是否可以使用JSF获取用户的浏览器ID号?我将JBoss 7用于应用程序服务器.

java jsf jboss web-applications jsf-2

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

如何将此HTML表转换为JSF表

我想将这个html表翻译成JSF表

<table border="1">
   <tr>
     <td>OS Verison</td>
     <td>Linux</td>
   </tr>
   <tr>
     <td>Installed packages</td>
     <td>30</td>
   </tr>
   <tr>
     <td>Free HDD Space</td>
     <td>30 GB</td>
   </tr>
   <tr>
     <td>Installed RAM</td>
     <td>2 GB</td>
   </tr>
</table> 
Run Code Online (Sandbox Code Playgroud)

我在Google上找到了很多关于如何编写JSF表的例子,该表以数据库的形式从列表中检索数据,但没有一个例子显示如何使用如上所述的两列创建表.

PS

如何重写此代码以实现相同的输出结果?

                    <h:dataTable id="books"
                             columnClasses="list-column-center,
                             list-column-right, list-column-center,
                             list-column-right" headerClass="list-header"
                             rowClasses="list-row" styleClass="list-
                             background" value="#{DashboardController.getDashboardList()}" var="store">   
                    <h:column>
                          <h:outputText  value="Session Timeout"/>
                          <h:outputText  value="Maximum Logged Users"/>
                    </h:column>
                    <h:column>                       
                          <h:outputText value="#{store.sessionTTL} minutes"/>
                          <h:outputText value="#{store.maxActiveUsers}"/>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                          <h:outputText  value="one"/>
                        </f:facet>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                          <h:outputText  value="two"/>
                        </f:facet>
                    </h:column>

                </h:dataTable> 
Run Code Online (Sandbox Code Playgroud)

我希望以类似第一个表的基本方式显示数据库表的内容,其中只有一行有2列.

java jsf

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

如何在h:selectOneMenu中将String转换为Integer

我想在JSF hLselectOneMenu中将String转换为Integer.

<h:selectOneMenu id="rowsPerPage" value="#{AccountsController.rowsPerPage}" converter="javax.faces.Integer" maxlength="3">                                    
    <f:selectItem itemValue="10" itemLabel="10" />
    <f:selectItem itemValue="50" itemLabel="50" />
    <f:selectItem itemValue="100" itemLabel="100" />
    <f:selectItem itemValue="500" itemLabel="500" />                                    
    <f:selectItem itemValue="094332" itemLabel="Custom" />
    <f:ajax render="customrowperpage" />
</h:selectOneMenu>&nbsp;
    <h:inputText id="customrowperpage" value="#{AccountsController.rowsPerPage}" rendered="#{AccountsController.rowsPerPage == '094332'}" required="true" />
Run Code Online (Sandbox Code Playgroud)

我如何在JSF页面中执行此操作?

PS我更新了代码,但AJAX代码无效.当我选择"自定义"时,不会渲染输入字段.

jsf jsf-2

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

无法恢复查看/page.jsf

我有一个我无法解决的问题.当我在页面空闲后刷新打开的JSF页面例如10分钟时,我收到以下错误消息:

serverError: class javax.faces.application.ViewExpiredException viewId:/page.jsf - View /page.jsf could not be restored.
Run Code Online (Sandbox Code Playgroud)

我怎样才能增加JSF查看时间?

jsf session-timeout jsf-2

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

JavaFX中的内部框架

我找到了内部框架的这个例子

http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html

是否可以在JavaFX中创建相同的内部框架?

javafx javafx-2 javafx-8

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

在PostgreSQL中生成随机字符串

我正在使用此SQL查询在PostgreSQL中生成随机值

chr(ascii('B') + (random() * 25)::integer)
Run Code Online (Sandbox Code Playgroud)

如何使用相同的查询生成15个字符随机字符串?

sql postgresql postgresql-9.3

7
推荐指数
6
解决办法
6674
查看次数

UnknownEntityTypeException:无法找到持久化器

我想在 Wildfly 上使用 JPA 和 Spring。我尝试了这个配置:

应用程序属性:

spring.jmx.enabled=false
spring.datasource.jndi-name=java:/global/production
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.jpa.show-sql = true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect
spring.jpa.hibernate.ddl-auto = create-drop
Run Code Online (Sandbox Code Playgroud)

POM 文件:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
        <relativePath />
    </parent>

    <dependencies>   
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
            <version>2.9.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>                
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>       
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
    </dependencies>
Run Code Online (Sandbox Code Playgroud)

配置:

@Configuration
@ComponentScan("org.rest.api.server.*")
public class AppConfig {

    @Bean
    public EntityManager entityManager(EntityManagerFactory emf) {
        return emf.createEntityManager();
    }
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试执行查询时,我得到:

Caused by: org.hibernate.UnknownEntityTypeException: Unable to locate persister: org.rest.api.server.repository.Terminals
10:28:27,539 …
Run Code Online (Sandbox Code Playgroud)

java spring jpa spring-data-jpa

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

ActiveProfile 在 Junit5 测试中不起作用

我想设置 Spring Profile 以测试不同的 JUnit 测试集。我试过这个:

应用程序属性:

spring.profiles.active=dev
Run Code Online (Sandbox Code Playgroud)

测试1

@IfProfileValue(name = "spring.profiles.active", values = {"test"})
@ActiveProfiles(profiles = {"test"})
public class SecondGenericTest {

    @Test
    public void secGenericTest() {

        System.out.println("Performing test ... for profile test");
    }
}
Run Code Online (Sandbox Code Playgroud)

测试2

@IfProfileValue(name = "spring.profiles.active", values = {"test"})
@ActiveProfiles(profiles = {"test"})
public class SecondGenericTest {

    @Test
    public void secGenericTest() {

        System.out.println("Performing test ... for profile test");
    }
}
Run Code Online (Sandbox Code Playgroud)

也尝试设置到 InteliJ Active 配置文件中:

在此输入图像描述

但每次都会执行这两个测试。是否有一些解决方案可以使用正确的活动配置文件运行测试?

POM配置:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.4.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.9.2</version>
        </dependency>
        <dependency> …
Run Code Online (Sandbox Code Playgroud)

java junit spring spring-boot junit5

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

kubectl exec [POD] [COMMAND] 已弃用,并将在未来版本中删除。使用 kubectl exec [POD] -- [COMMAND] 代替

我想在 Kubernetes 中使用令牌创建服务帐户。我试过这个:

完整日志:

root@vmi1026661:~# ^C
root@vmi1026661:~# kubectl create sa cicd
serviceaccount/cicd created
root@vmi1026661:~# kubectl get sa,secret
NAME                     SECRETS   AGE
serviceaccount/cicd      0         5s
serviceaccount/default   0         16d

NAME                                 TYPE                 DATA   AGE
secret/repo-docker-registry-secret   Opaque               3      16d
secret/sh.helm.release.v1.repo.v1    helm.sh/release.v1   1      16d
root@vmi1026661:~# cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: cicd
spec:
  serviceAccount: cicd
  containers:
  - image: nginx
    name: cicd
EOF
pod/cicd created
root@vmi1026661:~# kubectl exec cicd cat /run/secrets/kubernetes.io/serviceaccount/token && echo
kubectl exec [POD] [COMMAND] is DEPRECATED and …
Run Code Online (Sandbox Code Playgroud)

kubernetes

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