プロパティ「必須」JSF 2 + Prime Faces 3.5 の使用中に問題に直面しています。
以下のコードは完全に機能します。
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:decorate template="/templates/main_template.xhtml">
<ui:define name="centro">
<h:head>
</h:head>
<h:body>
<f:view>
<h:form id="form">
<h3>TITLE</h3>
<h:panelGrid id="panel1" columns="3">
<h:outputLabel for="input1" value="Input1" />
<p:inputText id="input1" value="#{controller.myObject.input1}" label="input1" required="#{empty param['form:input3']}"/>
<p:message for="input1" />
<h:outputLabel for="input2" value="Input2" />
<p:inputText id="input2" value="#{controller.myObject.input2}" label="input2" required="#{empty param['form:input3']}"/>
<p:message for="input2" />
<h:outputLabel for="input3" value="Input3" />
<p:inputText id="input3" value="#{controller.myObject.input3}" label="input3" required="#{empty param['form:input1']}"/>
<p:message for="input3" />
</h:panelGrid>
<p:commandButton id="btn" value="Save" update="form" actionListener="#{controller.save}" />
</h:form>
</f:view>
</h:body>
</ui:define>
</ui:decorate>
</html>
コードに TAB VIEW を追加すると、次のように必須フィールドの検証が機能しなくなります。
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:decorate template="/templates/main_template.xhtml">
<ui:define name="centro">
<h:head>
</h:head>
<h:body>
<f:view>
<h:form id="form">
<h3>#{msgs.clienteCadastroTitulo}</h3>
<p:tabView id="tabView">
<p:tab id="tab1" title="TAB 1">
<h:panelGrid id="panel1" columns="3">
<h:outputLabel for="input1" value="Input1" />
<p:inputText id="input1" value="#{controller.myObject.input1}" label="input1" required="#{empty param['form:input3']}"/>
<p:message for="input1" />
<h:outputLabel for="input2" value="Input2" />
<p:inputText id="input2" value="#{controller.myObject.input2}" label="input2" required="#{empty param['form:input3']}"/>
<p:message for="input2" />
<h:outputLabel for="input3" value="Input3" />
<p:inputText id="input3" value="#{controller.myObject.input3}" label="input3" required="#{empty param['form:input1']}"/>
<p:message for="input3" />
</h:panelGrid>
</p:tab>
</p:tabView>
<p:commandButton id="btn" value="Save" update="form" actionListener="#{controller.save}" />
</h:form>
</f:view>
</h:body>
</ui:define>
</ui:decorate>
</html>
私が試したすべてをここに投稿するわけではありませんが、チュートリアルや他のユーザーからの質問などで概説されているさまざまな方法を使用して試したことは確かです.
それでも、どこが間違っているのか、検証を正しく実行できるようにいくつかのヒントを教えてほしいのか理解できませんでした。
基本的に、必要なプロパティは、フォームのフィールドに応じて動的にする必要があります。
よろしくお願いします。