jsf-2

Although rendered=“false”, content of a h:dataTable is always evaluated

两盒软妹~` 提交于 2019-12-12 14:07:48
问题 I have got a problem with the HtmlDataTable of JSF 2.0. On my web page, i have got a h:dataTable and some other content, which should only be rendered if the user is logged in. The content of the HtmlDataTable is loaded from a database. Although the h:dataTable is not rendered when the user is not logged in, the content is still evaluated. Here is the code of the web page: <h:panelGroup rendered="#{userBean.loggedIn}"> <h:dataTable value="#{xxxBean.allXxx}" var="c"> <h:column> <h:outputText

How can I highlight UIInput using Primefaces when validation upon ajax request fails?

。_饼干妹妹 提交于 2019-12-12 13:48:20
问题 Validator Class: @FacesValidator("br.gov.valec.sicpd.util.CpfValidator") public class CpfValidator implements Validator { @Override public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException { if (validateCpf(value.toString())) { FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR,"Invalid Input","Invalid Input"); ((UIInput) component).setValid(false); // this line doesnt work throw new ValidatorException(msg); } } JSF snippet: <p

display growl when page is loaded primefaces jsf2

自闭症网瘾萝莉.ら 提交于 2019-12-12 12:26:03
问题 I have this commandButton : <p:commandButton value="Enregistrer" action="#{reglementClientMB.ajouter}" process="@this @form" update="@form" > <f:setPropertyActionListener target="#{reglementClientMB.est_ajouter}" value="false" /> </p:commandButton> the action method return to another page , I want to display one p:growl when the next page is loaded I tested to put that is the constructor of its managed bean but the growl is displayed below data in the page FacesContext.getCurrentInstance()

JSF Flash Scope remembers too many messages

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 12:12:10
问题 I have a simple flow in my appliaction - if you fill out and press save on one form (if everything goes well) you are redirected to a second view with a list. Now I wanted to add a message saying "You successfuly added an object" but since I'm using a redirect from what I remember I need to use the Flash scope. And so I did. The problem is that during the first "save" it correctly shows only 1 message but when I navigate back to the form and hit "save" it will show me the current message and

primefaces remoteCommand tag is not working when Passing html of my current page got through Jquery to managed bean

a 夏天 提交于 2019-12-12 12:05:21
问题 I am getting my current page HTML using Jquery's .html() method like this. <h:outputScript name="js/jquery-1.7.2.js" /> <h:outputScript> function getHtml(){ $('#next').click(function(){ htmlString=$('#wrapper').html(); alert(htmlString); command({param:htmlString}); }); } </h:outputScript> My XHTML page <div id="wrapper"> <form prependId="false"> // My HTML form with some input fields <h:commandButton id="next" value="Submit" action=#{bean.formvalues} onCick="getHtml();"> <h:commandButton> <p

Enum values in Composite Component attribute

南楼画角 提交于 2019-12-12 11:20:09
问题 My issue is quite simple : I want to create a composite component with a String attribute, Type. <cc:attribute name="type" /> This attribute will have 3 acceptable values, [TYPE1, TYPE2, TYPE3] Is it possible to say my component will accept only these values ? 回答1: Unfortunately no, you cannot put a compile/buildtime restriction on a composite component attribute value in the cc interface. You can however put a runtime restriction by checking the value in the cc implementation. <ui:param name

extendedDataTable - height doesn't work

自闭症网瘾萝莉.ら 提交于 2019-12-12 11:04:55
问题 So, like the title says in my case height of the extendedDataTable doesn't work, so my table also doesn't scroll because all rows are shown. I'm using richfaces4.0-final version. So here is my piece of code: <rich:extendedDataTable value="#{advancedSearchView.criteria}" var="criteria" height="50px" selection="#{advancedSearchView.selection}" id="table" selectionMode="single"> <rich:column id="criteria_row" filterBy="#{criteria}" filterEvent="onkeyup" width="500px"> <h:outputText value="#

JSF ViewScope - returning null on actions do not update the view

烈酒焚心 提交于 2019-12-12 10:56:36
问题 I have a Managed Bean in ViewScope mode. So, when I call some action from this Managed Bean my page do not update. I see that my action is invoked well and returning null (viewscope work flow is OK). So, what am I doing wrong? If I rerender the page using Ajax it works fine. EDIT: My Versions are: JSF 2.1.14 with Primefaces 3.4.1 My Code: @ManagedBean(name = "test") @ViewScoped public class TestMB implements Serializable { private String status; public String getStatus() { return this.status;

How can i show text with html tag in primefaces

穿精又带淫゛_ 提交于 2019-12-12 10:45:25
问题 I get a String from < p:editor> like this : < b>This is bold text< /b> . I want to show <b>This is bold text</b> in xhtml page. What tag can i use to do that ? 回答1: Use an outputText with escape="true" : <h:outputText escape="true" value="<b>This is bold</b>"/> As stated in the answer to this question: ...Facelets implicitly wraps inline [emphasis added] content in a component as represented by <h:outputText> So, if you don't use an outputText tag with the escape attribute set to true

JSF2 Dynamically loading pages by ajax

帅比萌擦擦* 提交于 2019-12-12 10:20:09
问题 I want to load pages into a central div when i click my menu links in JSF2.0. I set up a panelmenu and wrote a menu item like this. <p:menuitem > <h:commandButton value="Edit Details" action="#{formsBean.changeDisplay(1)}"> <f:ajax render=":editdiv"></f:ajax> </h:commandButton> </p:menuitem> The component to be updated is: <h:panelGroup id="editdiv" rendered="#{formsBean.edituserdiv}" layout="block"> <ui:include src="edituserdetails.xhtml"> </ui:include> </h:panelGroup> The function formsBean