다음과 같은 내 응용 프로그램에서 매우 이상한 문제가 발생했기 때문에 여기 있습니다. JSF 및 EJB가있는 전자 상거래 응용 프로그램이 있는데 작성하려고합니다. 사용자 정보가있는 양식 문제는 로그 된 사용자가있을 때 내 양식이 잘 표시되지 않고 로그되지 않은 상태에서 잘 표시되었다는 것입니다. O 관리 대상 빈 (MB)을 사용하여 치료를하고 있으며, 계정 개체를 저장하고 있습니다. 사용자가 기록한 계정 jsf composite를 사용하여 xhtml 페이지에 대한 양식 및 템플릿을 만듭니다.PrimeFaces inputText가 때때로 렌더링되지 않습니다.
는 또한 나는 글래스 피쉬에서 이러한 경고를 가지고 :
- 경고 : 뷰에서 ID firstName을 함께 구성 요소를 찾을 수 없습니다입니다.
- 경고 :보기에서 성이 lastName 인 구성 요소를 찾을 수 없습니다.
- 경고 : ID 거리가있는 구성 요소를 볼 수 없습니다.
- 경고 : ID가 postalCode 인 구성 요소를 볼 수 없습니다.
- 경고 : 볼 수있는 ID 도시 구성 요소를 찾을 수 없습니다.
렌더링되지 않았기 때문에 방화범이 끌 렸습니다.
<?xml version="1.0" encoding="UTF-8"?>
<!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:h="http://java.sun.com/jsf/html"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets">
<composite:interface>
<composite:attribute name="title" />
<composite:attribute name="first_name"/>
<!--ajouter des attributs pour le cas ou l'utilisateur est connecté -->
</composite:interface>
<composite:implementation>
<h:form id="form" class="span5 offset4">
<h2>#{cc.attrs.title}</h2>
<p:panel header="Adresse de Livraison">
<h:panelGrid id="gridpanel" columns="2" style="margin-bottom:10px">
<h:outputLabel for="firstName" value="Prenom : " />
<p:inputText id="firstName" value="#{cc.attrs.first_name}" binding="#{firstName}"/>
<h:outputLabel for="lastName" value="Nom : " />
<p:inputText id="lastName" binding="#{lastName}"/>
<h:outputLabel for="street" value="Rue : " />
<p:inputText id="street" binding="#{street}" />
<h:outputLabel for="postalCode" value="Code Postale : " />
<p:inputText id="postalCode" binding="#{postalCode}" />
<h:outputLabel for="city" value="Ville : "/>
<p:inputText id="city" binding="#{city}"/>
<h:outputLabel for="pbutton"/>
<h:commandButton id="pbutton" class="paypal-button"
action="Cart.xhtml"
actionListener="#{dataManagedBean.creatOrder(firstName.value,lastName.value,street.value,postalCode.value,city.value)}" />
</h:panelGrid>
</p:panel>
<ui:fragment rendered="#{!dataManagedBean.connected}">
<p:panel header="Connexion">
<h:panelGrid id="grid" columns="2" style="margin-bottom:10px">
<h:outputLabel for="login" value="Login : "/>
<p:inputText id="login" binding="#{login}" />
<h:outputLabel for="password" value="Mot de passe : "/>
<p:inputText id="password" binding="#{password}" />
<h:outputLabel for="accountCreationButton"/>
<h:commandButton id="accountCreationButton" value="Créer un compte" action="Cart.xhtml" actionListener="#{dataManagedBean.createAccount(login.value,password.value,dataManagedBean.creatOrder(firstName.value,lastName.value,street.value,postalCode.value,city.value))}"/>
</h:panelGrid>
</p:panel>
</ui:fragment>
</h:form>
</composite:implementation>
</html>
난 그냥에 노력하고있어 순간을 위해 : 여기
<ui:composition template="template/common/commonLayout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:component="http://java.sun.com/jsf/composite/component">
<ui:define name="title">Formulaire</ui:define>
<ui:define name="content">
<ui:fragment rendered="#{dataManagedBean.connected}">
<component:FormValidateCartComponent title="Valider mon panier" first_name="yann" />
</ui:fragment>
<ui:fragment rendered="#{not dataManagedBean.connected}">
<component:FormValidateCartComponent title="Valider mon panier" first_name="NoName" />
</ui:fragment>
</ui:define>
</ui:composition>
은 내 양식 구성 요소입니다 : 여기
는 (사용자가 액세스 /Form.xhtml) 내 XHTML 페이지 코드 first_name을 설정하지만 전에 말했듯이 모든 inputText가 html 렌더링에 누락되어 있습니다. 그게 어떻게 가능해 ? 연결을 끊고 양식에 액세스하면 모든 것이 정상입니다 ... 정말 감사합니다. 왜 이런 일이 발생하는지 모르겠군요. 연결 및 연결 해제 기능은 JPA에서 로그인 및 암호로 계정을 요청하고 연결을 끊습니다. 관리 빈에서 계정을 null로 설정하면됩니다.
EDIT : C :를 사용하여 문제가 해결되면! , 나도 몰라 왜 ... 당신이 단서를 :)이 있으면 알려주세요
관리 빈 부분 코드 :
public void connect(String login, String password) {
account = client.connect(login, password);
}
public String disconnect() {
if (account != null) {
account = null;
}
return "index.xhtml?faces-redirect=true";
}
public boolean isConnected() {
return account != null;
}
h : panelGroup으로 테스트 한 결과 문제가 동일합니다 ... 따라서 UI 조각이 아니지만 panelGroup을 유지할 것입니다. – Ko2r
''은 태그 처리기가 아닌 UI 구성 요소입니다. 당신이 묘사하는 증상은'','', 등 (태그가'rendered' 속성을 갖지 않은 태그 핸들러에만 해당합니다). 따라서이 "대답"은 오해의 소지가 있으며 구체적인 문제를 해결하기가 쉽지 않습니다. –
BalusC
그런 다음 예제 코드를 잘 살펴보고 뭔가를 찾았 으면 알려주고, 또 하나 더 생각해보십시오. 복합 컴포넌트를 사용하는 경우 JSF는 복합 컴포넌트의 각 컴포넌트에 ID를 붙일 것입니다. "unabled to find id"경고, @ balusc, 미안, 나는 Ui : fragment가 UiComponent라는 것을 알지 못했다. 이제는 내 지식에 추가되었다. – rekiem87