Password matching message in primefaces - jsf-2

I copied the exact code from this Primefaces http://blog.primefaces.org/?p=1512 blog about easy password validation
<h:outputLabel for="pwd1" value="Password 1: *" />
<p:password id="pwd1" value="#{registerMB.password}"
feedback="false" match="pwd2" label="Password 1" required="true" />
<h:outputLabel for="pwd2" value="Password 2: *" />
<p:password id="pwd2" value="#{registerMB.password}"
feedback="false" label="Password 2" required="true" />
<f:facet name="footer">
<p:commandButton value="Register" action="/pages/public/login" />
<p:commandButton value="Cancel" immediate="true"
action="/pages/public/login" />
</f:facet>
Validation works but I am only able to get the Validation Error. The message Password 1 should match Password 2 is never displayed. Is there anymore configuration for this?
I have Primefaces 3.4.1 downloaded

Try to add the following
validatorMessage atribute inside p:password tag id="pwd2":
<p:password id="pwd2" value="#{registerMB.password}"
feedback="false" label="Password 2" required="true"
validatorMessage="password 1 should match password 2"/>
add p:message tag to show the error below the h:form tag
<p:messages id="messages" showDetail="true" autoUpdate="true"/>

add <p:messages id="messages" showDetail="true" autoUpdate="true"/>
just like int Primefaecs Password Showcase
<h:form id="form">  
<p:panel header="Match Mode">
<p:messages id="messages" showDetail="true" autoUpdate="true"/>
<h:panelGrid columns="2" id="matchGrid">
<h:outputLabel for="pwd1" value="Password 1: *" />
<p:password id="pwd1" value="#{passwordBean.password5}" match="pwd2" label="Password 1" required="true"/>
<h:outputLabel for="pwd2" value="Password 2: *" />
<p:password id="pwd2" value="#{passwordBean.password5}" label="Password 2" required="true"/>
</h:panelGrid>
<p:commandButton id="saveButton" update="matchGrid" value="Save" />
</p:panel>
</h:form>  

Related

Show row data from datatable in dialog in JSF

I have a simple CRUD application written in JSF 2.2 and PrimeFaces 3.5. The database consists of two tables - Clients and Orders. I have a view with datatable where all clients are listed and in the last column are three buttons - for eidt, delete and showing the orders for each client. When edit button is clicked the data for the selected client should be loaded in a modal dialog form but no matter which button is pressed in the dialog always is loaded data for the client in the first row. Same for the delete button.
Here is the code of the view:
<h:form id="form">
<p:growl id="msgs" showDetail="true" />
<p:commandButton id="addNewClientButton" type="button"
onclick="add.show();" value="Add new client"
action="clientBeans.newClient" />
<br />
<p:dataTable var="client" value="#{clientBeans.getAllClients()}"
border="true">
<p:column headerText="Client Id">
<h:outputText value="#{client.clientId}" />
</p:column>
<p:column headerText="Name">
<h:outputText value="#{client.name}" />
</p:column>
<p:column headerText="Address">
<h:outputText value="#{client.address}" />
</p:column>
<p:column headerText="Email">
<h:outputText value="#{client.email}" />
</p:column>
<p:column headerText="Options">
<p:commandButton value="Edit" id="editClientButton"
action="#{clientBeans.editClient}" type="button"
update=":form:editClient" onclick="edit.show();">
<f:setPropertyActionListener
target="#{clientBeans.client}"
value="#{client}" />
</p:commandButton>
<p:commandButton action="#{clientBeans.deleteClient}"
value="Delete"
id="deleteClientButton" type="button"
onclick="remove.show();"
icon="ui-icon-circle-close">
<f:setPropertyActionListener
target="#{clientBeans.client.clientId}"
value="#{client}" />
</p:commandButton>
<p:commandButton
action="#orderBeans.getSpecificOrders(client.clientId)}"
value="Orders">
<f:setPropertyActionListener
target="#{clientBeans.client.clientId}"
value="#{client.clientId}" />
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
<h:form>
<p:dialog id="addNewClient" header="Add new client" widgetVar="add"
modal="true" resizable="false">
<p:panelGrid columns="2" border="false">
<h:outputLabel for="name" value="Name: " />
<p:inputText id="name" value="#{clientBeans.client.name}"
label="name" required="true" />
<h:outputLabel for="address" value="Address: " />
<p:inputText id="address"
value="#{clientBeans.client.address}"
label="address" required="true" />
<h:outputLabel for="email" value="Email: " />
<p:inputText id="email" value="#{clientBeans.client.email}"
label="email" required="true" />
<f:facet name="footer">
<p:commandButton
action="#{clientBeans.createClient}" value="Save"
icon="ui-icon-check" style="margin:0">
</p:commandButton>
</f:facet>
</p:panelGrid>
</p:dialog>
</h:form>
<h:form>
<p:dialog id="editClient" header="Edit client" widgetVar="edit"
modal="true" resizable="false">
<h:panelGrid columns="2" id="displayClient">
<h:outputLabel for="id" value="Id: " />
<h:outputText id="id" value="#{client.clientId}" label="id" />
<h:outputLabel for="name" value="Name: " />
<p:inputText id="name" value="#{client.name}" label="name"
required="true" />
<h:outputLabel for="address" value="Address: " />
<p:inputText id="address" value="#{client.address}" label="address"
required="true" />
<h:outputLabel for="email" value="Email: " />
<p:inputText id="email" value="#{client.email}" label="email"
required="true" />
<f:facet name="footer">
<p:commandButton
action="#{clientBeans.updateClient}" value="Save"
icon="ui-icon-check" style="margin:0">
</p:commandButton>
</f:facet>
</h:panelGrid>
</p:dialog>
</h:form>
<h:form>
<p:dialog id="deleteClient"
header="Are you sure you want to delete this client?"
widgetVar="remove" modal="true" resizable="false">
<p:panelGrid columns="2">
<h:outputLabel for="id" value="Id: " />
<h:outputText id="id" value="#{client.clientId}" label="id" />
<h:outputLabel for="name" value="Name: " />
<h:outputText id="name" value="#{client.name}" label="name" />
<h:outputLabel for="address" value="Address: " />
<h:outputText id="address" value="#{client.address}" label="address" />
<h:outputLabel for="email" value="Email: " />
<h:outputText id="email" value="#{client.email}" label="email" />
<f:facet name="footer">
<p:commandButton action="#{clientBeans.confirmDeleteClient}"
value="Delete" icon="ui-icon-circle-close" />
</f:facet>
</p:panelGrid>
</p:dialog>
</h:form>
I haven't gone through all the code, but I could quickly spot that you have misused <p:commandButton>: the attribute type="button" should only be used for invoking custom JavaScript (client) code, it is therefore not compatible with action and actionListener, that are suitable for invoking server actions. Remove this attribute and ensure that the managed beans's method #{clientBeans.editClient} is invoked.
Look at PrimeFaces documentation, commandButtons with type="button" are called "Push Buttons".
Second, use oncomplete instead of onclick, in order to show the dialog after the ajax method has completed its job.

Primefaces popup dialog not working

I have a jsf page having a popup button that opens a following dialog popup:
</h:form>
<p:dialog id="dialog" header="Select different user"
widgetVar="dlg" appendToBody="true">
<h:form id="form23">
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel for="username" value="Username:" />
<p:inputText value="#{loginBean.username}"
id="username" required="true" label="username" />
<h:outputLabel for="password" value="Password:" />
<h:inputSecret value="#{loginBean.password}"
id="password" required="true" label="password" />
<f:facet name="footer">
<p:commandButton id="loginButton" value="Login" />
</f:facet>
</h:panelGrid>
</h:form>
</h:form>
But instead of opening as popup it is getting displayed outside the page itself. the dialog is outside the main form. Help!!
I tried that but still the same problem persists..below is my modified code..
<h:form id="create-ticket">
<p:dialog id="dialog" header="Select different user" widgetVar="dlg" appendToBody="true">
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel for="username" value="Username:" />
<p:inputText value="#{loginBean.username}"
id="username" required="true" label="username" />
<h:outputLabel for="password" value="Password:" />
<h:inputSecret value="#{loginBean.password}"
id="password" required="true" label="password" />
<f:facet name="footer">
<p:commandButton id="loginButton" value="Login"
/>
</f:facet>
</h:panelGrid>
</p:dialog>
<h:panelGroup>
<h:outputLabel value="#{I18N['Create_Ticket_for_other_users']}" styleClass="atf-header"></h:outputLabel>
</h:panelGroup>
<h:panelGroup id="search_section" layout="block"
styleClass="atf-content-area atf-separarot-botton"> <!-- This is the section where we get the grey background -->
<h:panelGroup id="input_search_section" styleClass="">
<h:outputText id="name" value="Siddharth Mishra"
labelStyleClass="atf-label">
</h:outputText>
</h:panelGroup>
<h:panelGroup styleClass="atf-right atf-inline-block">
<p:commandButton id="btn_search" value="select different user"
styleClass="atf-button-search" onclick="dlg.show();" type="button"
>
</p:commandButton>
</h:panelGroup>
</h:panelGroup>
Now i only have one form you can see the popup dialog section + the button which is calling the popup under h:panelgroup.Atached is the image how the form currently looks Thanks in advance
You need to restructure your code.
*Don't nest forms inside other forms.
*You dont have the end-tag of your p:dialog.
<h:form>
<p:dialog id="dialog" header="Select different user"
widgetVar="dlg" appendToBody="true">
//Content ex inputtext
</p:dialog>
<p:commandButton value="Show Dialog" onclick="dlg.show();" type="button" />
</h:form>

command button not invoking action on multiple tabs p:tabView

I am facing a problem in p:tabView with dynamic="true" which i am stuck in for days.
I have three tabs each having separate form and p:fileUpload with command button for submitting the form and upload file.
The problem is my first form or tab works fine but the other two are not working or firing command button action at all, instead ti refreshes the page. They are invoked only when second time form filled and button pressed.
And to add one thing more the fileUploadListeners even work fine in all these tabs but the command button wont work or fire action method for other two tabs(only the first time form filled and submitted after that works fine):
Is there something wrong with this primefaces tag(i m using latest version of primefaces 3.5 also) or i am mistaking or missing something?? any kind of guidance will be helpful.
Here is the page code which is included in another main page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition 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"
template="/MasterPage/Master.xhtml">
<ui:define name="Search">
<div class="searchBarDiv"></div>
<br class="clear" />
<div class="resultMainDiv" style="background-color: white;">
<p:layout style="width:1218px;height:558px;" id="layout">
<p:ajax event="toggle" />
<p:layoutUnit position="west" size="300" header="UPDATES"
resizable="true" collapsible="true" styleClass="sliderDiv"
style="color:pink;">
</p:layoutUnit>
<p:layoutUnit position="center" styleClass="resultDiv">
<div class="uploadDiv">
<p:tabView id="tabview" cache="false" dynamic="true">
<p:tab id="docTab" title="Document">
<h:form id="docf" >
<h:panelGrid id="grid" columns="1">
<h:panelGroup>
<h:outputLabel styleClass="advLabel"
for="mId" value="Title ">
</h:outputLabel><h:outputLabel style="color: red;">*</h:outputLabel>
<h:inputText id="mId"
styleClass="txtfield"
value="#{documentInsertController.documentTitle}">
</h:inputText>
</h:panelGroup>
<h:panelGroup>
<h:outputLabel class="advLabel">Dated </h:outputLabel>
<p:calendar styleClass="txtfield" id="dtxtOrginated"
mode="popup" navigator="true" yearRange="1900:2015"
pattern="dd-MMM-yyyy"
converter="CalendarDateStringConverter"
value="#{documentInsertController.documentOriginatedOn}" />
</h:panelGroup>
<h:panelGroup>
<h:outputLabel class="advLabel">KeyWord</h:outputLabel><h:outputLabel
style="color: red;"> *</h:outputLabel>
<h:inputText id="dtxtKeywordsList"
value="#{documentInsertController.documentKeywords}"
styleClass="txtfield" />
</h:panelGroup>
<h:panelGrid rendered="#{renderBean.viewLoad}">
<h:panelGroup> <h:outputLabel class="advLabel">Select Document</h:outputLabel><h:outputLabel
style="color: red;"> *</h:outputLabel>
<p:fileUpload id="fu" allowTypes="/(\.|\/)(DOC|DOCX|doc|docx|ppt|xls|xlsx|pdf)$/"
multiple="false" mode="advanced" sizeLimit="41949000" showButtons="false"
fileUploadListener="#{documentInsertController.uploadPListener}" label="Browse"
value="#{documentInsertController.file}" >
<h:message id="docMSG" for="fu"></h:message>
</p:fileUpload>
</h:panelGroup>
<h:panelGroup>
<p:commandButton id="DocUpoadLoad" styleClass="btn"
value="Load File For Preview" ajax="false"
action="#{documentInsertController.loadDocForPreview}"
style="background-color:#FEAA41;background-image:none;color:white;font-weight:bold;width:170px; height:25px;">
</p:commandButton>
</h:panelGroup>
</h:panelGrid>
</h:panelGrid>
</h:form>
<p:commandButton id="DocUploadbtn" value="Upload"
action="#{documentInsertController.saveDocument}"
ajax="false"
style="background-color:#FEAA41;background-image:none;color:white;font-weight:bold; ">
</p:commandButton>
</h:panelGrid>
</p:tab>
<p:tab id="imgTab" title="Image">
<h:form id="imagef" >
<h:panelGrid id="grid" columns="1">
<h:panelGroup> <h:outputLabel class="advLabel">Title </h:outputLabel> <h:outputLabel
style="color: red;"> *</h:outputLabel>
<h:inputText id="txtImgTitle"
value="#{mediaInsertController.mediaTitle}"
styleClass="txtfield" >
</h:inputText>
</h:panelGroup>
<h:panelGroup> <h:outputLabel class="advLabel">Taken Date</h:outputLabel>
<p:calendar styleClass="txtfield"
id="imgtxtOrginated" mode="popup" navigator="true"
yearRange="1900:2015" pattern="dd-MMM-yyyy"
converter="CalendarDateStringConverter"
value="#{mediaInsertController.mediaTakenOn}" />
</h:panelGroup>
<h:panelGroup> <h:outputLabel class="advLabel">Description</h:outputLabel>
<h:inputTextarea id="txtImgDescription"
value="#{mediaInsertController.mediaDescription}"
styleClass="txtImgDescription" /></h:panelGroup>
<h:panelGroup> <h:outputLabel class="advLabel">Select Image</h:outputLabel><h:outputLabel
style="color: red;"> *</h:outputLabel>
<p:fileUpload id="fuImage" allowTypes="/(\.|\/)(jpeg|jpg|png|bmp|gif|GIF|PNG)$/"
multiple="false" mode="advanced" sizeLimit="6291456" showButtons="false"
label="Browse" invalidSizeMessage="File exceeds limmit 6 MB "
value="#{mediaInsertController.file}" fileUploadListener="#{mediaInsertController.uploadPListener}" />
<h:message id="imgMSG" for="fuImage"></h:message>
</h:panelGroup>
<p:commandButton styleClass="btn" id="btnUploadImage_Click" ajax="false"
value="Upload" actionListener="#{mediaInsertController.saveImage}"
style="background-color:#FEAA41;background-image:none;color:white;font-weight:bold; ">
</p:commandButton>
</h:panelGrid>
</h:form>
</p:tab>
<p:tab id="vidTab" title="Video">
<h:form id="videof" >
<h:panelGrid id="grid" columns="1">
<h:panelGroup>
<h:outputLabel class="advLabel">Title </h:outputLabel> <h:outputLabel
style="color: red;"> *</h:outputLabel>
<h:inputText id="vtxtTitle"
value="#{mediaInsertController.mediaTitle}"
styleClass="txtfield" maxlength="50" >
</h:inputText></h:panelGroup>
<h:panelGroup> <h:outputLabel class="advLabel">Taken Date</h:outputLabel>
<p:calendar styleClass="txtfield" id="vtxtOrginated"
mode="popup" navigator="true" yearRange="1900:2015"
pattern="dd-MMM-yyyy"
converter="CalendarDateStringConverter"
value="#{mediaInsertController.mediaTakenOn}" />
</h:panelGroup>
<h:panelGroup> <h:outputLabel for="txtVidDescription"
value="Description" styleClass="advLabel"></h:outputLabel>
<h:inputTextarea id="txtVidDescription"
value="#{mediaInsertController.mediaDescription}"
styleClass="txtUploading" style="height:40px" />
</h:panelGroup>
<h:panelGroup> <h:outputLabel class="advLabel">Select Video</h:outputLabel><h:outputLabel
style="color: red;"> *</h:outputLabel>
<p:fileUpload id="fuVideo" allowTypes="/(\.|\/)(mp4|flv|swf)$/" invalidFileMessage="Invalid file content"
multiple="false" mode="advanced" sizeLimit="629145699" showButtons="false" update="vidMSG"
fileUploadListener="#{mediaInsertController.uploadPListener}" label="Browse" invalidSizeMessage="Size exeeds limit 600MB"
value="#{mediaInsertController.file}" />
<h:message id="vidMSG" for="fuVideo"></h:message>
</h:panelGroup>
<p:commandButton styleClass="btn" id="btnUploadVideo_Click" ajax="false"
value="Upload" action="#{mediaInsertController.saveVideo}"
style="background-color:#FEAA41;background-image:none;color:white;font-weight:bold; ">
</p:commandButton>
</h:panelGrid>
</h:form>
</p:tab>
</p:tabView>
</div>
</p:layoutUnit>
</p:layout>
<p:growl autoUpdate="true" sticky="true" id="uploadMSG"></p:growl>
</div>
</ui:define>
</ui:composition>
Your commandButton id="DocUploadbtn" is outside the h:form, that could be affecting things. There also seem to be three closing h:panelGrid tags around the same area; could it be malformed XHTML?

Primefaces3.5+JSF2.1.9 Request processing after Clicking link or Button twice

I am using Primefaces3.5 with Jsf2.1.9 i am getting a weired issue with
<p:commandButton>
as well as
<p:commandLink>
I have to press button as well as link more than one then JSF bean method is calling otherwise on Single click nothing Happening as i read some Stackoverflow Question this Issue relates to JSF but even using Primfaces3.5 with their Components i am getting this issue.Any one know How can i resolve this issue.
My JSF page
<ui:composition xmlns:jsp="http://java.sun.com/JSP/Page"
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:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
template="./../portfolio/PortfolioViewTemplate.xhtml">
<ui:define name="moduleContent">
<p:panel id="panel" header="Portfolio Transaction">
<p:messages id="msgs" />
<p:panelGrid id="addMoreTrans" columns="2" style="border-style:none;">
<f:facet name="header">
Add Trades
</f:facet>
<p:dataTable var="moreTrans"
value="#{portfolioTransactionBean.listOfTrasPanel}" style="border:none;" >
<p:column style="border:none;">
<p:panelGrid columns="7" id="transactionPanel1"
style="display: inline-block;border:none;">
<h:outputLabel for="tipsSuggestionBoxId" value="Company Name:*"></h:outputLabel>
<h:outputText value="Date:*" />
<h:outputText value="Type:*" />
<h:outputText value="Quantity:*" />
<h:outputText value="Price:*" />
<h:outputText value="Brokerage:" />
<h:outputText value="Notes:" />
<p:autoComplete id="tipsSuggestionBoxId"
completeMethod="#{applicationScopeBean.autoSelectCompany}"
value="#{portfolioTransactionBean.txnCurrentRecord.companyName}"
minChars="3" nothingLabel="No similar company found"
requestDelay="1" minQueryLength="3" required="true"
requiredMessage="Company Name Cannot be empty">
</p:autoComplete>
<p:calendar id="from_date1" size="10" required="true"
requiredMessage="Date Cannot be empty"
value="#{portfolioTransactionBean.txnCurrentRecord.umptTransDate}"
mode="popup" showOn="both" pattern="dd/MM/yyyy"
popupIconOnly="true" readonly="#{facesContext.renderResponse}"
navigator="true" showButtonPanel="true">
</p:calendar>
<p:selectOneMenu id="tranType"
value="#{portfolioTransactionBean.txnCurrentRecord.umptTransType}">
<f:selectItem itemLabel="Transaction Type" itemValue="" />
<f:selectItem itemLabel="Buy" itemValue="Buy" />
<f:selectItem itemLabel="Sell" itemValue="Sell" />
<f:selectItem itemLabel="Bonus" itemValue="Bonus" />
<f:selectItem itemLabel="Split" itemValue="Split" />
</p:selectOneMenu>
<p:spinner id="transQuntity1" required="true"
value="#{portfolioTransactionBean.txnCurrentRecord.umptQty}"
min="1" label="Quanity" size="5"
validatorMessage="Field Is mandatory" />
<p:spinner id="transPrice1" required="true" size="5"
value="#{portfolioTransactionBean.txnCurrentRecord.umptPrice}"
label="Price" validatorMessage="Field Is mandatory" />
<p:spinner id="brokerage1" size="5"
value="#{portfolioTransactionBean.txnCurrentRecord.umptBrokerage}" />
<h:inputText
value="#{portfolioTransactionBean.txnCurrentRecord.umptNotes}" />
</p:panelGrid>
<p:separator id="customSeparator" style="width:100%;height:10px" />
</p:column>
</p:dataTable>
<f:facet name="footer">
<p:commandButton value="Clear"
actionListener="#{portfolioTransactionBean.clearRecord}"
process="#this"
rendered="#{portfolioTransactionBean.onClickofButton}">
</p:commandButton>
<p:spacer width="100" height="10" />
<p:commandButton value="Save Transaction " icon="ui-icon-check"
action="#{portfolioTransactionBean.savePortfolioTransaction}"
style="float:right;right:20%;"
rendered="#{portfolioTransactionBean.onClickofButton}">
</p:commandButton>
<p:commandButton value="Add More Transaction " icon="ui-icon-check"
action="#{portfolioTransactionBean.addMoreTransPanel}"
process="#this" update="addMoreTrans"
rendered="#{portfolioTransactionBean.onClickofButton}" />
</f:facet>
</p:panelGrid>
<p:panelGrid columns="2" id="allTransactionPanel">
<p:dataTable value="#{portfolioTransactionBean.transactionsList}"
var="tradeRec">
<f:facet name="Header">
<h:outputText>Recently Added Trades</h:outputText>
</f:facet>
<p:column headerText="Company">
<h:outputText value="#{tradeRec.companyName}"></h:outputText>
</p:column>
<p:column headerText="Date">
<h:outputText value="#{tradeRec.umptTransDate}">
<f:convertDateTime dateStyle="medium"></f:convertDateTime>
</h:outputText>
</p:column>
<p:column headerText="Type">
<h:outputText value="#{tradeRec.umptTransType}"></h:outputText>
</p:column>
<p:column headerText="Quantity">
<h:outputText value="#{tradeRec.umptQty}"></h:outputText>
</p:column>
<p:column headerText="Price">
<h:outputText value="#{tradeRec.umptPrice}">
<f:convertNumber maxFractionDigits="2"></f:convertNumber>
</h:outputText>
</p:column>
<p:column headerText="Brokerage">
<h:outputText value="#{tradeRec.umptBrokerage}">
<f:convertNumber maxFractionDigits="2"></f:convertNumber>
</h:outputText>
</p:column>
</p:dataTable>
</p:panelGrid>
</p:panel>
</ui:define>
</ui:composition>
Template File...
<ui:composition xmlns:jsp="http://java.sun.com/JSP/Page"
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:c="http://java.sun.com/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
template="./../templates/MasterTemplate.xhtml">
<ui:define name="moduleDetails">
<h:form name="portfolioMenuForm">
<f:event type="javax.faces.event.PreRenderViewEvent" listener="#{applicationScopeBean.preRenderView}"/>
<table style="width: 100%; min-height: 500px; border: none">
<tr>
<td>
<p:menu>
<p:submenu label="Portfolio Views">
<p:menuitem value="Add Transactions" action="PortfolioTransactionMgmt" update="#form" immediate="true" />
<p:menuitem value="View Transactions" action="PortFolioTranView" update="#form" immediate="true" />
<p:menuitem value="Latest Holdings" action="PortfolioHolding" update="#form" immediate="true" />
<p:menuitem value="Sector Allocations" action="#{portfolioTransactionBean.showSecAllocation}" update="#form" immediate="true" />
<p:menuitem value="Realized Profit" action="PortfolioRelizeProfit" update="#form" immediate="true" />
<p:menuitem value="Portfolio Performance" action="#{portfolioTransactionBean.showPortPerformance}" update="#form" immediate="true" />
<p:menuitem value="Benchmark Comparison" action="#{portfolioTransactionBean.showBenhComparison}" update="#form" immediate="true" />
</p:submenu>
</p:menu>
</td>
<td>
<ui:insert name="moduleContent"></ui:insert>
</td>
</tr>
</table>
</h:form>
</ui:define>
</ui:composition>
Basically this is not weired issue
On first click jsf first looks whether there is (javax.faces.ViewState) state available or not and if it is not available then it creates one for you & when you click second time because of Jsf state available it makes call to bean method.
Solution : try creating jsf state through the javascript function
Thanks to Çağatay Çivici Project lead of primefaces .He suggest me
Try with 2.1.17 then, showcase is 2.1.17.
So i updated my pom for jsf and it work like a charm.
Thanks

JSF form value change does not work

I have a form with 4 fields (2 dates, 2 selectOne).
My Bean is SessionScoped.
When I change the values in the form once, and click on submit, the applications works fine.
But when I want to change the values in form again, nothing happens. no change nor execution.
My Form looks like:
<ui:define name="sidebar">
<p:panel header="Select Values">
<h:form id="graphform">
<p:growl id="msg" />
<p:panelGrid columns="1">
<h:outputLabel for="servervalue" value="Servervalue: " />
<p:selectOneMenu value="#{graph.servervalue }" id="servervalue">
<f:selectItems value="#{formconst.SERVERVALUES}" />
</p:selectOneMenu>
<h:outputLabel for="startdate" value="Startdate: " />
<p:calendar disabledWeekends="false" size="10" pattern="dd.MM.yyyy"
showOtherMonths="true" maxlength="10"
mindate="#{formconst.MINDATE }" maxdate="#{formconst.MAXDATE}"
showButtonPanel="true" navigator="true" readOnlyInputText="true"
id="startdate" value="#{graph.startdate }" showOn="button"
required="true" />
<h:outputLabel for="enddate" value="Enddate: " />
<p:calendar disabledWeekends="false" size="10" pattern="dd.MM.yyyy"
showOtherMonths="true" maxlength="10"
mindate="#{formconst.MINDATE }" maxdate="#{formconst.MAXDATE }"
showButtonPanel="true" navigator="true" readOnlyInputText="true"
id="enddate" value="#{graph.enddate }" showOn="button"
required="true" />
<h:outputLabel for="filter" value="Filter: " />
<p:selectOneMenu value="#{graph.filter }" id="filter">
<f:selectItems value="#{formconst.GENERALFILTER}" />
</p:selectOneMenu>
</p:panelGrid>
<p:separator />
<p:panelGrid columns="2">
<p:commandButton value="Submit" update="#all"
action="#{ graph.updateChart }" />
<p:commandButton value="Reset" update="#all"
action="#{ graph.resetChart }" />
</p:panelGrid>
</h:form>
</p:panel>
</ui:define>
<ui:define name="content">
<h:form id="linechart">
<p:lineChart value="#{graph.cartesianChartBean.chartmodel }"
enhancedLegend="true" legendPosition="nw" xaxisAngle="50" />
</h:form>
</ui:define>
The same happens when I change SessionScoped to ViewScoped or RequestScoped.
I can change the values only one time.
I use primefaces 3.2 with apache myFaces 2.0.2 on WebSphere Application Server 8.0
Best Regards Veote

Resources