我使用的primeface 3.0
和jsf 2.0
。
我已经准备好了客户端母版,它使用向导添加客户端,同时反映在可数据化中。然后我更新了可更新的编辑实用程序。然后我添加了删除按钮,并尝试调用bean的删除方法。
但是当我点击删除按钮时,添加客户端的向导验证被执行。所以我创建了另一个文件ClientEditdatatable.xhtml
并包含在clientmaster.xhtml
中,但结果仍然相同。现在,我想添加删除实用程序中的日期。我尝试了很多技巧来做到这一点。
我只是想通过操作监听器传递客户端标识,删除并刷新可更新的命令按钮,但不执行方法。我的代码如下:
ClientMaster.xhtml
<h:body>
<ui:composition template="/template/mainLayout.xhtml" >
<ui:define name="pageContent">
<h:form id="cm">
<p:growl life="5000" showDetail="true" showSummary="true" id="mymessage" autoUpdate="true"/>
<br/>
user id :#{sessionScope.USER_ID};
<br/>
<p:wizard widgetVar="wiz" flowListener="#{clientUitility.onFlowProcess}" showNavBar="true" >
<p:tab id="personal" title="Personal" >
<p:panel id="personal1" header="Personal Details">
<!-- <h:messages errorClass="error"/> -->
<h:panelGrid columns="6" styleClass="grid">
<h:outputText value="First Name:*" />
<p:inputText required="true" label="FirstName"
value="#{clientUitility.client.firstName}" >
</p:inputText>
<h:outputText value="Middle Name:*" />
<p:inputText required="true" label="MidddleName"
value="#{clientUitility.client.middleName}" />
<h:outputText value="Last Name:*" />
<p:inputText required="true" label="LastName"
value="#{clientUitility.client.lastName}" />
<h:outputText value="Login ID:* " />
<p:inputText required="true" label="LoginID"
value="#{clientUitility.client.loginID}"/>
<h:outputText value="Password:* " />
<p:inputText required="true" label="Password"
value="#{clientUitility.client.password}"/>
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab id="address" title="Address" >
<p:panel id="address1" header="Adress Details">
<!-- <h:messages errorClass="error"/> -->
<h:panelGrid columns="6" styleClass="grid">
<h:outputText value="Address:*" />
<p:inputText required="true" label="Address1"
value="#{clientUitility.client.address1}" />
<h:outputText />
<p:inputText label="Address2"
value="#{clientUitility.client.address2}" />
<h:outputText />
<p:inputText label="Address3"
value="#{clientUitility.client.address3}" />
<h:outputText value="City:* " />
<p:inputText required="true" label="City"
value="#{clientUitility.client.city}" />
<h:outputText value="Pincode:* " />
<p:inputText required="true" label="Pincode"
value="#{clientUitility.client.pincode}" />
<h:outputText value="State:* " />
<p:inputText required="true" label="State"
value="#{clientUitility.client.state}" />
</h:panelGrid>
</p:panel>
</p:tab>
<p:tab id="contact" title="Contact" >
<p:panel id="contact1" header="Contact Information">
<!-- <h:messages errorClass="error"/> -->
<p:panelGrid columns="4" styleClass="grid">
<h:outputText value="Mobile:* " />
<p:inputText required="true" label="MobileNo"
value="#{clientUitility.client.mobileNo}" />
<h:outputText value="Email ID: "/>
<p:inputText label="EmailID"
value="#{clientUitility.client.emailID}" />
<h:outputText value="STD Code: "/>
<p:inputText label="STDCode"
value="#{clientUitility.client.stdCode}" />
<h:outputText value="Phone No: "/>
<p:inputText label="PhoneNo"
value="#{clientUitility.client.phoneNo}" /> </p:panelGrid>
</p:panel>
</p:tab>
<p:tab id="confirm" title="Confirmation" >
<p:panel id="confirm1" header="Confirm and Submit">
<h:panelGrid columns="6" styleClass="grid" >
<h:outputText value="First Name: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.firstName}" />
<h:outputText value="Middle Name: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.middleName}" />
<h:outputText value="Last Name: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.lastName}" />
<h:outputText value="Login ID: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.loginID}"/>
<h:outputText value="Password: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.password}"/>
<h:outputText/>
<h:outputText/>
<h:outputText value="Address: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.address1}" />
<h:outputText />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.address2}" />
<h:outputText />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.address3}" />
<h:outputText value="City: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.city}" />
<h:outputText value="State: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.state}" />
<h:outputText value="Pincode: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.pincode}" />
<h:outputText value="Email ID: " />
<h:outputText styleClass="outputLabel"
value="#{clientUitility.client.emailID}" />
<p:commandButton id="addClient" immediate="true" value="Add Client" actionListener="#{clientUitility.save}" oncomplete="wiz.loadStep (wiz.cfg.steps [0], true)" update="@parent,:cm:clientList"> <!-- update="@parent,:cm:clientList" -->
</p:commandButton>
</h:panelGrid>
</p:panel>
</p:tab>
</p:wizard>
<ui:include id="ce" src="ClientEditDatatable.xhtml"/>
</h:form>
</ui:define>
</ui:composition>
</h:body>
ClientEditDatatable。xhtml
<h:body>
<h:form id="fce">
<p:confirmDialog message="Delete client?" severity="alert" widgetVar="confirmDeleteClient" visible="false" appendToBody="true">
<p:commandButton value="Yes" update=":cm:fce:clientList" oncomplete="confirmDeleteClient.hide()" actionListener="#{clientUitility.deleteRecord}" >
</p:commandButton>
<p:commandButton value="No" onclick="confirmDeleteClient.hide()" type="button" />
</p:confirmDialog>
<p:dataTable var="client" value="#{clientUitility.clientAll}" id="clientList" editable="true"
rowKey="#{client.clientID}" paginator="true" rows="10" rowsPerPageTemplate="10,15,20">
<p:column headerText="First Name" style="width:125px" filterBy="#{user.firstname}" sortBy="#{client.firstName}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.firstName}" />
</f:facet>
<f:facet name="input">
<h:outputText value="#{client.firstName}" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Middle Name" style="width:125px" filterBy="#{client.middleName}" sortBy="#{client.middleName}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.middleName}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.middleName}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Last Name" style="width:125px" filterBy="#{client.lastName}" sortBy="#{client.lastName}" >
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.lastName}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.lastName}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Login ID" style="width:125px" filterBy="#{client.loginID}" sortBy="#{client.loginID}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.loginID}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.loginID}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Password" style="width:125px" filterBy="#{client.password}" sortBy="#{client.password}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.password}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.password}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Address1" style="width:125px" filterBy="#{client.address1}" sortBy="#{client.address1}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.address1}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.address1}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Address2" style="width:125px" filterBy="#{client.address2}" sortBy="#{client.address2}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.address2}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.address2}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Address3" style="width:125px" filterBy="#{client.address3}" sortBy="#{client.address3}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.address3}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.address3}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="City" style="width:125px" filterBy="#{client.city}" sortBy="#{client.city}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.city}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.city}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="State" style="width:125px" filterBy="#{client.state}" sortBy="#{client.state}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.state}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.state}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Pincode" style="width:125px" filterBy="#{client.pincode}" sortBy="#{client.pincode}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.pincode}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.pincode}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Mobile No" style="width:125px" filterBy="#{client.mobileNo}" sortBy="#{client.mobileNo}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.mobileNo}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.mobileNo}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="STD Code" style="width:125px" filterBy="#{client.stdCode}" sortBy="#{client.stdCode}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.stdCode}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.stdCode}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Phone No" style="width:125px" filterBy="#{client.phoneNo}" sortBy="#{client.phoneNo}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.phoneNo}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.phoneNo}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Email ID" style="width:125px" filterBy="#{client.emailID}" sortBy="#{client.emailID}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{client.emailID}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{client.emailID}" style="width:100%" >
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Edit" style="width:50px">
<p:rowEditor />
</p:column>
<p:ajax event="rowEdit" listener="#{clientUitility.editRowListner}" update=":cm:mymessage"/>
<p:column headerText="Delete" style="width:50px">
<p:commandButton id="deleteClient" value="Delete" onclick="confirmDeleteClient.show()" title="Delete this Client" styleClass="ui-icon-closethick">
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
</h:body>
客户端实用程序。JAVA
@ManagedBean
@ViewScoped
public class ClientUitility {
private ClientBean client = new ClientBean();
private List<ClientBean> clientAll = new ArrayList<ClientBean>();
/** Creates a new instance of ClientUitility */
public ClientUitility() {
clientAll = new ArrayList<ClientBean>();
int userID = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString());
clientAll = ClientService.GenerateClientList(userID);
}
public List<ClientBean> getClientAll() {
return clientAll;
}
public void setClientAll(List<ClientBean> clientAll) {
this.clientAll = clientAll;
}
public ClientBean getClient() {
return client;
}
public void setClient(ClientBean client) {
this.client = client;
}
public String onFlowProcess(FlowEvent event) {
System.out.println("Current wizard step:" + event.getOldStep());
System.out.println("Next step:" + event.getNewStep());
System.out.println("First name : " + client.getfirstName());
System.out.println("Last name : " + client.getlastName());
System.out.println("Age name : " + client.getloginID());
return event.getNewStep();
}
public void editRowListner(RowEditEvent rowEditEvent) {
try {
ClientBean updatedClient = (ClientBean) rowEditEvent.getObject();
System.out.println("Client First Name: " + updatedClient.getfirstName());
ClientService.EditClient(updatedClient);
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("Updated", updatedClient.getfirstName() + " " + updatedClient.getlastName()));
} catch (Exception e) {
e.getMessage();
}
}
public void deleteRecord(ActionEvent actionEvent) {
try {
//System.out.println("Client ID: " + actionEvent.getComponent().getAttributes().get("cID").toString());
System.out.println("delete client of User ID: " + FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString());
FacesMessage msg = new FacesMessage("Client Deleted", "");
FacesContext.getCurrentInstance().addMessage(null, msg);
} catch (Exception e) {
e.printStackTrace();
}
}
public void save(ActionEvent actionEvent) { client.setuserID(Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString()));
System.out.println("Client ID : " + client.getclientID());
System.out.println("User ID : " + client.getuserID());
ClientService.AddClient(client);
client = new ClientBean();
clientAll = ClientService.GenerateClientList(Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("USER_ID").toString()));
FacesMessage msg = new FacesMessage("Client Created", "");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
我错在哪里了?
您不能也不应该嵌套表单。
在ClientMaster中。xhtml
,替换
<ui:include id="ce" src="ClientEditDatatable.xhtml"/>
</h:form>
由
</h:form>
<ui:include id="ce" src="ClientEditDatatable.xhtml"/>
我正在开发一个带有ActionBars的应用程序,它支持姜饼和其他功能。所以基本上我在使用支持库并扩展 行动B活动 对于我所有的活动。除了 onSupportNavigateUp() 方法。它只是不被调用在留档中所述。 每当用户选择从操作栏在应用程序的活动层次结构中向上导航时,就会调用此方法。 这很容易,但我一直不明白为什么它不能像预期的那样工作,谷歌也帮不上忙。这是虫子吗?还是我错过了什么?
运行playstore Build Apk时,未调用Marshmallow Runtime Permissions onRequestPermissionsResult,但正常调试Apk时运行良好。谁来帮帮我。。谢谢 OnRequestPermissionResult方法
我很难让正常工作。无论我怎么努力,我都不能让它被称为。 我的应用程序的体系结构如下所示:我的主活动包含一个片段,其中包含一个ViewPager,而ViewPager又有四个子片段实例。目前,我正在(成功地)用填充活动中的初始选项菜单,但我希望添加一些对应于每个活动子片段的额外选项。 如果有人知道这里发生了什么,我会非常感激,因为我已经被困在这个问题上两天了。 更新--我已经搞清楚了现在的问题是什么
CustomDialog 下面是http://www.theappguruz.com/blog/android-take-photo-camera-gallery-code-sample
我使用: null 我正在使用zuul和负载平衡rest模板从另一个微服务调用一个微服务: 请求到达下游服务,但未在ZullFilter中设置头(我使用了不同的头): 我还创建了一个过滤器: 我错过了什么?为什么不能调用筛选器?在我的案件中是否应该引用?
我试图发送一个意图,从一个活动中的创建启动一个意图服务。但是,IntentService的onHandleIntent永远不会被接收。我尝试过用意图过滤器改变清单,但似乎没有任何效果。没有抛出异常,但是根本没有调用IntentService。 这是onCreate 这是IntentService类的创建者和OnHandleContent,我知道它不会被调用,因为logcat从不显示“检索到的意图”
问题内容: 我有一个非常简单的Servlet和一个非常简单的HttpSessionListener: 我的方法从未被调用(没有日志输出),最终我在调用getSession()的那一行上得到一个 我尝试拨打电话时也没有问题,但存在相同的问题。 我不明白- 注释不足以调用我的侦听器吗?Eclipse甚至在下方将其显示为侦听器。 问题答案: 原来这是愚蠢的Eclipse问题之一… Project-> C
问题内容: 我正在使用创建全屏图片库。当用户旋转设备,我执行更新的内 我以模态呈现,并占据了全屏。在中,我将流程布局创建为: 我也有这样的大小: 当我旋转设备时,它永远不会被调用,这将导致无法更新。旋转设备时,确实收到消息: 我已在线阅读可以添加的内容: 到,但已经没有影响。没有任何内容或版块插图。 我也有在函数内的被调用。谁能协助我解决造成此问题的原因? 问题答案: 如果您只关心设备旋转时的布局