jsf-2

Validate field and throw exception in JSF, but attach error message to another field?

假装没事ソ 提交于 2020-03-03 05:56:25
问题 I have some fields on my page which I want cross-validated. But I don't want error from this validation to be displayed in <h:message> for this fields. If I add validator to any of the fields, and validator throws exception, error is displayed in <h:message> for this field. On the other hand I HAVE TO throw exception if I want to suppress page from submitting. Just displaying some error message is not enough. So I created some hidden field on the form, and attached validator there. This

Validate field and throw exception in JSF, but attach error message to another field?

落爺英雄遲暮 提交于 2020-03-03 05:55:49
问题 I have some fields on my page which I want cross-validated. But I don't want error from this validation to be displayed in <h:message> for this fields. If I add validator to any of the fields, and validator throws exception, error is displayed in <h:message> for this field. On the other hand I HAVE TO throw exception if I want to suppress page from submitting. Just displaying some error message is not enough. So I created some hidden field on the form, and attached validator there. This

Primefaces TabView does not maintain selectOneMenu Values

我们两清 提交于 2020-02-28 06:42:27
问题 Hi I have a primefaces tabView looks like this <!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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui"> <h:head></h:head> <h:body> <p:messages /> <h:form id="form"> <p:tabView dynamic="true"> <p:tab title="Tab"> <p

Preserving bean values between views

余生长醉 提交于 2020-02-24 04:06:45
问题 I'm looking for best practices regarding preserving bean values between views using JSF 2. Consider the following scenario: * In view A, the view scoped bean ABean is instantiated and retrieves data for display in the view. * In view A you can click on an entry to view details for it in view B. * When returning from view B to view A, the data previously retrieved by ABean is displayed. What is the best way to preserve the data retrieved by ABean, to be able to display it again when returning

How JSTL tags evaluated in JSF 2.1 for the below

别来无恙 提交于 2020-02-16 06:29:18
问题 I have the below Test.xhtml where i can select mode as Sea/Air. I don't want to load the all the 4 pages(Page1.xhtml, Page2.xhtml, Page3.xhtml, Page4.xhtml) into the jsf view tree. In my scenario, mode once selected and saved that can not be changed to other mode. The saved mode will be shown as view mode. Since at any point of time i need only 2 files (Page1.xhtml, Page2.xhtml (or) Page3.xhtml, Page4.xhtml)... I am using the JSTL tag handler for dynamic including the pages. the below thing

Compare two fields that use same class

*爱你&永不变心* 提交于 2020-02-12 05:13:55
问题 I have two input fields fromDate and toDate which are instances of Date class. The Date class uses custom Date validator which validates the month, day and year fields contained in the date field. The custom date validator is specific for each date i.e, fromDate and toDate. I need to compare the month, day or year fields of fromDate with toDate. If the fromDate is greater than toDate, a validation message has to displayed. Update: The fromDate and toDate are two custom date components as

Compare two fields that use same class

前提是你 提交于 2020-02-12 05:13:47
问题 I have two input fields fromDate and toDate which are instances of Date class. The Date class uses custom Date validator which validates the month, day and year fields contained in the date field. The custom date validator is specific for each date i.e, fromDate and toDate. I need to compare the month, day or year fields of fromDate with toDate. If the fromDate is greater than toDate, a validation message has to displayed. Update: The fromDate and toDate are two custom date components as

h:commandbutton, how to redirect to external site?(JSF 2) [duplicate]

家住魔仙堡 提交于 2020-02-08 08:49:40
问题 This question already has an answer here : Redirect to external URL in JSF (1 answer) Closed 4 years ago . When i use command button to redirect to pages, inside my project, u just need to give the name of the page with no extention, followed by ?faces-redirect=true in the action attribute and i will get redirected. But what if i want to get redirected to an external page(example:www.google.com)? I tried in many ways: www.google.com, google.com, http://google.com but i failed. This is what i

Reload and refresh table from ajax call

ε祈祈猫儿з 提交于 2020-02-07 03:07:29
问题 I want to create a form which when it's submitted it renders and executes a second form: <h:form id="paymentform"> <div> ..... </div> <h:commandButton id="buy" type="submit" value="Put" action="#{dashboard.calculateProcessing}" > <f:ajax render="@form formdddasd" execute="@form formdddasd"/> </h:commandButton> </h:form> Second form which must be reloaded and refreshed: <h:form id="formdddasd"> <h:dataTable id="formdd" value="#{orders.cdList}" var="cd" rendered="#{orders.cdList ne null}" .....

How to make composite component similar to <h:selectOneRadio />

对着背影说爱祢 提交于 2020-02-03 11:38:50
问题 I have been searching a lot for a way to make a composite component similar to: <h:selectOneRadio /> but I did not succeed. I want something like: <myowntags:selectOneRadio> <f:selectItem itemValue="value0" itemLabel="This is the value 0" /> <f:selectItem itemValue="value1" itemLabel="This is the value 1" /> <f:selectItem itemValue="value2" itemLabel="This is the value 2" /> </myowntags:selectOneRadio> and: <myowntags:selectOneRadio> <f:selectItems value="#{controller.items}" /> </myowntags