JSF2的Inputtext小部件将不允许用户在XHTML UI中输入数据



我正在将JSF1.1应用程序转换为JSF2。然而,我发现,当我从初始视图导航到新视图时,inputText小部件将不允许从屏幕输入任何数据。使用锚标记或在浏览器中输入url调用的初始视图不会出现此问题。我使用的是Wildfly 19.1 Primefaces 7.0和JSF 2.3。我该如何调试它?

这是我的pom.xml文件。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.llts</groupId>
<artifactId>LingoMavenApps</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>LingoMavenApps</name>
<repositories>
<repository>
<id>myMavenRepoLltsRead</id>
<url>https://mymavenrepo.com/repo/604lAqKzBoKcfngw9N2d/</url>
</repository>
<repository>
<url>http://repository.primefaces.org/</url>
<id>PrimeFaces-maven-lib</id>
<layout>default</layout>
<name>Repository for library PrimeFaces-maven-lib</name>
</repository>
<repository>
<id>JBoss repository</id>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>myMavenRepoLltsWrite</id>
<url>https://mymavenrepo.com/repo/ETqr5l5RKE7x67iZUvi9/</url>
</repository>
</distributionManagement>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jsf.version>2.3.2</jsf.version>
<javase.version>1.8</javase.version>
<javaee-endorsed.version>7.0</javaee-endorsed.version>
<javaee.version>8.0</javaee.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.20</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>18.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.primefaces/primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>${jsf.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>${javaee.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.llts</groupId>
<artifactId>burnsiderest</artifactId>
<version>1.7.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${javase.version}</source>
<target>${javase.version}</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>${javaee-endorsed.version}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/LingoMavenApps/resources
</outputDirectory>
<resources>          
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>              
</configuration>            
</execution>
</executions>
</plugin>            
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>

这是其中一个UI视图,client.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!-- 
Document   : client
Created on : Mar 9, 2020, 5:49:08 PM
Author     : mphoenix
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<h:outputStylesheet name="css/burnsideweb.css" />
<title>JSF Page</title>
</h:head>
<h:body>
<f:view>
<p:messages showDetail="true" showSummary="true" id="msgs">
<p:autoUpdate />
</p:messages>
<h:panelGrid columns="3" styleClass="tableComp" >
<h:outputText value="Client Creator" styleClass="title"/>
<h:outputText style="width: 30px" />
<h:form enctype="multipart/form-data"  prependId="false">
<h:panelGroup styleClass="ccXmlUploader">
<h:outputText value="Load XML File" style="font-size: 10pt;"/>
<br/>
<p:fileUpload update="process" auto="true" style="width:500px;"
fileUploadListener="#{clientCreator.handleUpload}" allowTypes="/(.|/)(xml)$/" />
<br/>
<h:commandButton value="Apply" type="submit" action="#{clientCreator.processClientFile}"
disabled="#{clientCreator.processDisabled}"
id="process" />
</h:panelGroup>
</h:form>
</h:panelGrid>
<p/>
<p:dialog
widgetVar="statusDialog"
modal="true"
draggable="false"
resizable="false"
showHeader="false"
position="center top+150"
closable="false"
style="padding: 20px;">  
<h:outputText value="Processing... patience please."
style="padding-right:15px;" />
<p/>
<h:graphicImage library="images" name="spinning-wait-icons/wait30trans.gif" width="50"/>  
</p:dialog>   
<h:form id="clientCreatorForm" >
<h:panelGroup id="warning">
<h:outputText value="WARNING: #{clientCreator.specialInstructions}" styleClass="warning" rendered="#{not empty clientCreator.specialInstructions}" />
</h:panelGroup>
<h:outputText value="#{clientCreator.xmlMsgs}"/>
<h:panelGrid id="op" columns="1">
<h:outputText style="height: 20px" />
<h:outputText value="Company Information" styleClass="subTitle" />
<h:outputText style="height: 10px" />
<h:panelGrid id="company" columns="2">
<h:outputText value="Select Company:" styleClass="required"/>
<p:selectOneMenu value="#{clientCreator.clientCompanyName}" style="width: 400px" >
<p:ajax event="itemSelect" 
update="footerPanel, msgs, entitydependencies, entityselect, client, warning"   
listener="#{clientCreator.companyCheck}" />
<f:selectItems value="#{clientCreator.companyItemsAvailable}" />
</p:selectOneMenu>
</h:panelGrid>
<h:outputText style="height: 20px" />
<p:commandButton id="companyButton" value="Add New Company" rendered="#{menubean.companyCreatorAuthorized}"
action="#{clientCreator.goToCompanyCreator}" />
<h:outputText style="height: 20px" />
<h:outputText value="Client Information" styleClass="subTitle" />
<h:outputText style="height: 10px" />
<h:panelGrid id="client" columns="5" >
<h:outputText value="First Name:" styleClass="required"/>
<p:inputText value="#{clientCreator.client.firstName}" >
<p:ajax listener="#{clientCreator.requiredInputTest}" 
event="keyup" 
update="footerPanel" />
</p:inputText>
<h:outputText style="width: 40px" />
<h:outputText value="Last Name:" styleClass="required" />
<p:inputText  value="#{clientCreator.client.lastName}" >
<p:ajax listener="#{clientCreator.requiredInputTest}"
event="keyup"
update="footerPanel" />
</p:inputText>
<h:outputText value="E-mail(x@y.z):" styleClass="required" 
rendered="#{!clientCreator.noValidEmail}"/>
<h:outputText value="No Valid Email" rendered="#{clientCreator.noValidEmail}"/>
<p:inputText id="ClientEmail" value="#{clientCreator.client.email}" disabled="#{clientCreator.noValidEmail}">
<p:ajax listener="#{clientCreator.requiredInputTest}"
event="keyup"
update="footerPanel" />
</p:inputText>
<h:outputText style="width: 40px" />
<h:outputText value="Job Title:" />
<h:inputText value="#{clientCreator.client.title}" />
<h:outputText value="Address:" />
<h:inputText value="#{clientCreator.client.address}" />
<h:outputText style="width: 40px" />
<h:outputText value="Address2:" />
<h:inputText id="clientaddr2" value="#{clientCreator.client.address2}" />
<h:outputText value="City:" />
<h:inputText id="clientcity" value="#{clientCreator.client.city}" />
<h:outputText style="width: 40px" />
<h:outputText value="State:" />
<h:inputText id="clientstate" value="#{clientCreator.client.state}" />
<h:outputText value="Postal Code:" />
<h:inputText value="#{clientCreator.client.postalCode}" />
<h:outputText style="width: 40px" />
<h:outputText value="Country:" />
<h:inputText value="#{clientCreator.client.country}" />
<h:outputText value="Phone:" />
<h:inputText value="#{clientCreator.client.phone}" size="40" />
<h:outputText style="width: 40px" />
<h:outputText value="Ext:" />
<h:inputText value="#{clientCreator.client.phoneExt}" size="40" />
<h:panelGroup>
<h:outputText value="Client PO Number:" rendered="#{clientCreator.clientPONumber eq ''}" />
</h:panelGroup>
<h:panelGroup>
<h:inputText id="po" value="#{clientCreator.clientPONumber}" rendered="#{clientCreator.clientPONumber eq ''}" />
</h:panelGroup>
<h:outputText style="width: 40px" />
<h:outputText value="Client Custom ID 1:" />
<h:inputText value="#{clientCreator.client.clientID1}" />
<h:outputText value="Client Custom ID 2:" />
<h:inputText value="#{clientCreator.client.clientID2}" />
<h:outputText style="width: 40px" />
<h:outputText value="Client Custom ID 3:" />
<h:inputText value="#{clientCreator.client.clientID3}" />
<h:panelGroup id="entprojlabel" >
<h:outputText value="Legal Entity:" styleClass="required" rendered="#{clientCreator.userSpecificEntity}"/>
</h:panelGroup>
<h:panelGroup id="entprojlist">
<p:selectOneMenu id="entityselect" value="#{clientCreator.client.legalEntity}" rendered="#{clientCreator.userSpecificEntity}">
<p:ajax listener="#{clientCreator.entityCheck}"
event="itemSelect" 
update="footerPanel, entitydependencies"/>
<f:selectItems value="#{clientCreator.legalEntityItemsAvailable}" />
</p:selectOneMenu>
</h:panelGroup>
<h:outputText style="width: 40px" />
<h:outputText value="No Valid EMail?"/>
<p:selectBooleanCheckbox value="#{clientCreator.noValidEmail}">
<p:ajax event="change" update="client" />
</p:selectBooleanCheckbox>
<h:outputText value="Username:" styleClass="required"
rendered="#{clientCreator.noValidEmail}"/>
<p:inputText value="#{clientCreator.fakeEmailUserName}" 
disabled="#{!clientCreator.noValidEmail}"
rendered="#{clientCreator.noValidEmail}">
<p:ajax listener="#{clientCreator.requiredInputTest}"
event="keyup"
update="footerPanel" />
</p:inputText>
</h:panelGrid>
<h:panelGrid id="entitydependencies" columns="2">
<h:outputText value="LLS Client ID:" 
rendered="#{clientCreator.entitySet and clientCreator.lls and !clientCreator.clientIDSet}"/>
<h:inputText value="#{clientCreator.client.llsClientID}"
rendered="#{clientCreator.entitySet and clientCreator.lls and !clientCreator.clientIDSet}"/>
<h:outputText value="Billing Contact Email:" 
rendered="#{clientCreator.entitySet and !clientCreator.lls and !clientCreator.billingEmailSet}"/>
<h:inputText value="#{clientCreator.client.billingEmail}" 
rendered="#{clientCreator.entitySet and !clientCreator.lls and !clientCreator.billingEmailSet}"/>
<h:outputText value="Special Billing Instructions:" 
rendered="#{clientCreator.entitySet and !clientCreator.lls and !clientCreator.billingInstructionsSet}"/>
<h:inputText value="#{clientCreator.client.billingInstructions}" 
rendered="#{clientCreator.entitySet and !clientCreator.lls and !clientCreator.billingInstructionsSet}"/>                       
</h:panelGrid>
<h:outputText style="height: 20px" />
<h:outputText value="Boldface labels mean input is required" styleClass="required"/>
<h:outputText style="height: 20px" />
<h:panelGrid id="footerPanel" columns="3" >
<p:commandButton id="enterbutton" value="Add Client"
action="#{clientCreator.processClient}"
update="footerPanel"
onstart="PF('statusDialog').show('',{top:'100px', left:'400',height:'75px', width:'200px', opacity: '0'})" 
oncomplete="PF('statusDialog').hide()" 
disabled="#{clientCreator.enterDisabled}"/>
<p:commandButton id="clearButton" value="Clear" action="#{clientCreator.clear}" />
<p:commandButton id="cancelButton" value="Return" action="#{clientCreator.cancel}"
rendered="#{clientCreator.ccClient}" />
</h:panelGrid>
</h:panelGrid>
</h:form>
<h1><h:outputText value="You are trying to access one of the LLTS custom apps from outside the Dashboard; this is not permitted. Please log into the dashboard at http://pm.llts.com:9090/LingoApps/faces/menu/menulogon.jsp and access the custom app you want from there."  
rendered="#{!(menubean.clientCreatorAuthorized)}"/></h1>
</f:view>
</h:body>
</html>

下面是从托管bean导航到上述UI的方法。

public String returnToUserPage() {
setXmlMsgs("");
setClientCompanyName(getCompanyName());
companyCheck();
getClient().setLegalEntity(getClientCompany().getLegalEntityCompany());
return "client";
}

好吧,我需要做的是在导航时使用重定向选项。例如,上面的方法应该以结束

return "client?faces-redirect=true"

相关内容

  • 没有找到相关文章

最新更新