Rectangle 27 5

You can't ajax-update a component which is by itself conditionally rendered. The JSF ajax engine JavaScript doesn't add/remove the update target in the HTML DOM tree, instead it replaces the update target in the HTML DOM tree. If the JSF component is not rendered, then the JSF ajax engine would not get anything to replace with. You have instead to ajax-update a parent which is always rendered. You can use among others a <h:panelGroup> for it.

<h:panelGroup id="fileUploadGroup">
    <p:fileUpload id="fileUpload"
        rendered="#{!fileUploadController.hidden}"
        ...
        update="fileUploadGroup" />
</h:panelGroup>

Thanks BalusC. It works!!! You know all the hack man... You rocks always... thank you so much...

jsf - attribute rendered is not working properly with Primefaces 3.5 f...

jsf primefaces
Rectangle 27 5

Since PrimeFaces 3.0, there is a new HeadRenderer which allows customizable resource ordering. See also this blog. This has overriden the standard JSF head renderer. This is at its own okay, but apparently it failed to properly recognize inline scripts with target of head. This is clearly a bug in PrimeFaces head renderer. Your best bet is to report this issue to PF guys.

In the meanwhile, if you aren't making use of that new PrimeFaces feature at all, then just put Mojarra's own HeadRenderer back as default head renderer by adding the following entry to faces-config.xml:

<render-kit>
    <renderer>
        <component-family>javax.faces.Output</component-family>
        <renderer-type>javax.faces.Head</renderer-type>
        <renderer-class>com.sun.faces.renderkit.html_basic.HeadRenderer</renderer-class>
    </renderer>
</render-kit>

Note: in case you're using MyFaces instead of Mojarra, obviously reference MyFaces own one instead.

jsf - h:outputScript with target="head" not working with Primefaces 3....

jsf primefaces mojarra
Rectangle 27 1

Oops!!!I missed selection attribute in for the datatable.Now it is working fine.

<p:dataTable var="lpcData" value="#{lpcBean.lpcIdList}" selection="#{lpcBean.selectedRows}" 
              id="lpcList" editable="true" scrollable="true" scrollWidth="1110"
              tableStyle="table-layout:auto; width:1130px;" scrollHeight="330" 
              styleClass="datatable">

jsf 2 - Primefaces row editing not working properly - Stack Overflow

jsf-2 primefaces
Rectangle 27 3

The trick is Primefaces have developed the Fileupload functionality based on below plugin.So, I started there and got it working in primefaces

id
<p:fileUpload/>
<p:fileUpload id="advancedupload" widgetVar="advupload"
              fileUploadListener="#{fileUploadController.handleFileUpload}"
              mode="advanced" dragDropSupport="true" multiple="true"
              update="messages" sizeLimit="10000000" fileLimit="2"
              allowTypes="/(\.|\/)(gif|jpe?g|png|pdf)$/" />
HTML5 File Upload component in the browser
script
$(window).load(function(){
        $('#advancedupload').fileupload({
            dropZone: $(document)
         });
     });

Should be $(window).load() otherwise it complain about component not found in DOM. That's it does the trick.

Did not work for me. Can someone confirm that this solution is still valid for Primefaces 6.0 ?

jquery - Primefaces File upload, Drop file outside of p:fileUpload any...

jquery jsf file-upload jsf-2 primefaces
Rectangle 27 5

If you want that user must not be able to change the value of the Calender Dates, just view it then use showOn="none" and readonly="true" in p:calender attribute, I have used it and its working (I'm using Primefaces 5.0 hope it works on all versions) :

jsf 2 - readOnlyInput doesn't work in p:calendar primefaces - Stack Ov...

jsf-2 primefaces calendar readonly
Rectangle 27 1

Your problem occurs because our table is not rendered it simply does not exist in your html code, that is not in this context to be found to update or another source.

When you shut a larger scope as the panel and force an update in this it forces the table to check the condition for rendering, if yes the code is written and can be seen without problems.

Thanks for the reply, but could you please help me to understand how to fix the issue? Thanks

primefaces - JSF rendered is not working after commandButton - Stack O...

jsf primefaces
Rectangle 27 1

Hi I found answer for my question, The command button is not working because of rendered tag and Request scope of managed bean , as on every subsequent request after pressing command button my request scoped (iseditable ) is getting resetting. When i made it Session scoped its working Fine.

jsf - Unable to execute Backing bean method - Stack Overflow

jsf primefaces
Rectangle 27 1

Hi I found answer for my question, The command button is not working because of rendered tag and Request scope of managed bean , as on every subsequent request after pressing command button my request scoped (iseditable ) is getting resetting. When i made it Session scoped its working Fine.

jsf - Unable to execute Backing bean method - Stack Overflow

jsf primefaces
Rectangle 27 3

Your complete method is returning an instance of a complex class and thereby you need a converter. Without the existense of a converter, your component is thinking that its working with a string and trying to give reference to it when getting value and label attributes. Try using this and see if it works but I strongly recommend creating your own converter based on your needs:

@FacesConverter("anySelectConverter")
public class AnySelectConverter implements Converter{


     private static Map<Object, String> entities = new ConcurrentHashMap<Object, String>();

        @Override
        public String getAsString(FacesContext context, UIComponent component, Object entity) {

            // TODO : Fix
            if(entity == null)
                return "";

            synchronized (entities) {
                if (!entities.containsKey(entity)) {
                    String uuid = UUID.randomUUID().toString();
                    entities.put(entity, uuid);
                    return uuid;
                } else {
                    return entities.get(entity);
                }
            }
        }

        @Override
        public Object getAsObject(FacesContext context, UIComponent component, String uuid) {
            for (Entry<Object, String> entry : entities.entrySet()) {
                if (entry.getValue().equals(uuid)) {
                    return entry.getKey();
                }
            }
            return null;
        }

    }

Will try to use a converter, I was actually looking for a way to avoid the use of a converter. Does primefaces only accept "simple" classes as output for the complete method?

Accepts string only, thereby usage of converters become mandatory, the alternative requires you to do all that manually. I suggest creating an anySelectConverter for basic, rarely used components and custom converters for relatively more important components.

Answered in the comment area of the question.

I'll give that a try!

java - Primefaces p:autcomplete issues with String field in POJO - Sta...

java jsf primefaces autocomplete facelets
Rectangle 27 3

<p:remoteCommand name="remoteSwitchPage" actionListener="#{circuitBean.redirect}" />
getRedirect
circuitBean.redirect()
action
actionListener
<a href="#" onclick="logoutAccount()"><i class="fa fa-sign-out fa-fw"></i> Logout</a>

Another part of HTML (end of the page):

<h:form prependId="false">
    <p:remoteCommand action="#{sessionMB.logout()}" name="logoutAccount" />
</h:form>
public void logout() {
    account = null;
    logged = false;
    FacesUtil.addInfoGrowl(MessageProvider.getMessage("message.logout.success"), null);
    FacesUtil.redirectToPage("", true);
}
public static boolean redirectToPage(String completePath, Boolean keepMessages) {
    try {
        FacesContext.getCurrentInstance().getExternalContext().getFlash().setKeepMessages(keepMessages);
        FacesContext.getCurrentInstance().getExternalContext().redirect(SimegoUtil.redirectProject() + completePath);

        return true;
    } catch (IOException ex) {
        FacesUtil.addErrorGrowl(MessageProvider.getMessage("message.redirectFail"), null);
        return false;
    }
}

I just didn't get the template part you said, if i can help in something more just tell me, hope you fix it.

Thanks for the sample code. Is it possible to call logoutAccount() programatically, after X seconds, without needing the user to click on it? Edit: See, this is why I wanted to use that method in plain JavaScript (<script>logoutAccount()</script>)

The only solution I could think of is creating an invisible button, which will be "pressed" via some JavaScript

For me, it worked the opposite: using actionListener="#circuitBean.redirect}". Using actionListener="#circuitBean.redirect()}" doesn't work: it seems it cann't find the method

i used only action="#{bean.method()}", if you can paste your method it would help :)

java - JSF & Primefaces - RemoteCommand not working properly - Stack O...

java javascript jsf-2 primefaces
Rectangle 27 3

Your dialog is being moved out of the form after it is rendered on the page. This is a side-effect of the way the client side widgets work for Primefaces dialogs.

appendToBody="true"

If this doesn't work then make sure that your dialog is not surrounded by a form, but instead put a form element inside the dialog.

java - Primefaces : Ajax Call Inside p:dialog is not working - Stack O...

java spring jsf primefaces
Rectangle 27 1

Partial updates of dataTables and ajax updates of dataTables triggered from a component within the dataTable are not working in the 2.2 version of Primefaces. This is a known bug that may have been resolved in version 3.

One suggestion you can try is to use a single form for each dataTable and only update elements from within that one form.

jsf - Ajax call is made but the related fields are updated only after ...

ajax jsf primefaces
Rectangle 27 9

Like as with rendered attribute, JSF re-evaluates the disabled attribute in the server side during processing of the form submit as part of safeguard against tampered requests and like. You're however enabling/disabling it by JS without notifying the server side of the changes.

You need to ensure that the value of the disabled attribute evaluates false during the request whenever you intend the button to be enabled during processing of the form submit. For example, bind it to a boolean property of a view scoped bean which is set by the other button.

<h:commandButton disabled="#{bean.laughDisabled}" />

I have always been using this way. However, I saw PrimeFaces's client-side API earlier and I thought that I could save a boolean property. Turned out it's still needed :P. Thanks!

jsf - not working when disable="true" initially - St...

jsf button primefaces
Rectangle 27 3

What you're actually looking for is the itemDisabled attribute on the f:selectItems component. It's this attribute that disables a selectItem from being selected. Historically, primefaces has had problems with that attribute.

Ideally, you should have

<p:selectOneMenu value="#{Mybean.value}" required="true" requiredMessage="Required data">
       <f:selectItem itemLabel="" itemValue="#{null}" noSelectionOption="true" />
       <f:selectItems itemDisabled="#{Mybean.value=='aValue'}" value="#{Mybean.ListValues}" var="option" itemLabel="#{option.optionName}"      itemValue="#{option.optionId}"/>
  </p:selectOneMenu>

The link you've referenced is referring to the <h:selectOneMenu/> not <p:selectOneMenu/> that you're trying to use @unpix; they're not the same and they're not interchangeable

jsf - hideNoSelectionOption in selectOneMenu is not working as expecte...

jsf primefaces selectonemenu
Rectangle 27 3

What you're actually looking for is the itemDisabled attribute on the f:selectItems component. It's this attribute that disables a selectItem from being selected. Historically, primefaces has had problems with that attribute.

Ideally, you should have

<p:selectOneMenu value="#{Mybean.value}" required="true" requiredMessage="Required data">
       <f:selectItem itemLabel="" itemValue="#{null}" noSelectionOption="true" />
       <f:selectItems itemDisabled="#{Mybean.value=='aValue'}" value="#{Mybean.ListValues}" var="option" itemLabel="#{option.optionName}"      itemValue="#{option.optionId}"/>
  </p:selectOneMenu>

The link you've referenced is referring to the <h:selectOneMenu/> not <p:selectOneMenu/> that you're trying to use @unpix; they're not the same and they're not interchangeable

jsf - hideNoSelectionOption in selectOneMenu is not working as expecte...

jsf primefaces selectonemenu
Rectangle 27 3

I had a similar problem once with the dataTable exporter. You have to use an outputText like this:

<h:outputText value="#{valuesTable.tkValue}"/>

inside all the column tags, in order to see the values properly. Your column would become:

<p:column headerText="Technical Knowledge" id="tk">  
     <h:outputText value="#{valuesTable.tkValue}"/>
</p:column>

Replace all your columns and try that! Hope it helps!

And also I think the headers are not ok. You have to use an f:facet tag like this:

<p:column id="tk">
     <f:facet name="header">  
        <h:outputText value="Technical Knowledge" />  
     </f:facet>  
     <h:outputText value="#{valuesTable.tkValue}"/>
</p:column>

Now you should also see the headers in the export CSV file.

You are welcome!

jsf 2 - DataTable export is not working in Primefaces 4.0 - Stack Over...

jsf-2 primefaces
Rectangle 27 6

Captcha component in Primefaces currently does not support ajax behavior , that why you must use ajax="false" in your <p:commandButton , you page must be fully reloaded for the captcha to work properly...

If you must have the ajax behavior you could use some other third party solution...

Haven't tried the following, but it might help with ajax issues:

Which third party solutions do you propose for ajax behavior? I would like to show recaptcha in a wizard dialog which is based on ajax requests and primefaces is definitly not a working solution for this problem.

jsf 2 - Primefaces Captcha Component not working - Stack Overflow

jsf-2 primefaces
Rectangle 27 3

try to add the attribute immediate="true" in the in the tag p:ajax and my bean method was called

<p:ajax  event="cellEdit" 
         update="ListC"
         immediate="true"
         listener="#{recruitmentProcessMB.onCellEdit}"
         process="@this" 
/>

jsf - CellEdit event not working after cell edit in primefaces - Stack...

jsf primefaces jsf-2.2 tablecelleditor
Rectangle 27 5

You need to sort at least one column if you want to use a summaryRow, it's on the showcase and the documentation.

I already have some columns with sortBy, as you can see now on the code (I've updated it).

If you don't add the attribute sortBy on the <p:datatable> tag, you need to manually sort the column, with the header button.

jsf - SummaryRow in p:dataTable not working - Stack Overflow

jsf jsf-2 primefaces datatable
Rectangle 27 1

Managed it as said in the comment of Simegos' Post.

I created a hidden button that would be clicked every X seconds by JavaScript. Every page that becomes rendered after the button got clicked, needs to implement the following code. It would be ideal to put the code in a template which all rendered pages will implement.

<h:form id="form" class="hidden"> --> Hidden button
    <h:commandButton id="switchPageButton" action="#{circuitBean.renderNextScreen()}"/>
</h:form>    
<h:outputScript>
    $(function() {
        $(".hidden").each(function() { --> Declare Form as hidden, since it becomes overwritten by JSF
            $(this).css("display","none");
        });
        var switchPageLink = $("#form\\:switchPageButton"); --> Get Button via ID
        window.setInterval(function() {
            switchPageLink.click(); --> Click it 
        }, #{circuitBean.pageInterval}); --> after X seconds. I'm reading the interval through the bean here. You can just put a number in there
    });
</h:outputScript>

I'm glad to hear that you fixed it :) good job, you can also mark your answer as the correct or mine if you want to, to don't let this question as unanswered

java - JSF & Primefaces - RemoteCommand not working properly - Stack O...

java javascript jsf-2 primefaces