jsf-2

Unhighlight first highlighted item from AutoComplete

…衆ロ難τιáo~ 提交于 2019-12-24 04:47:08
问题 Here I am using p:autoComplete tag in PrimeFaces 5.1, but I can't remove first highlighted/selected item from the suggestions list. How I can remove this ? 回答1: Since your "problem" comes from this particular line, firstItem.addClass('ui-state-highlight'); What happens here is when the suggestions are ready to show up the script highlights the first item of the list, so in your case you would just "unhighlight" that item. I have created a small function that would do that on every

Why can't I inject 2 EJB's into 2 different managed beans that inject each other?

蹲街弑〆低调 提交于 2019-12-24 04:34:05
问题 ContactsBean @Named(value = "contactsBean") @SessionScoped public class ContactsBean implements Serializable { @EJB ContactsFacade contactsEJB; private List<Contacts> contacts = new ArrayList<Contacts>(); @Inject DetailsBean detailsBean; Details Bean @Named(value = "detailsBean") @RequestScoped public class DetailsBean { @EJB ContactsFacade contactsEJB; private Contacts detailsContact = new Contacts(); I can't do this. Whenever I called the EJB in details bean it throws EJB exception and this

How to execute javascript method from server side?

强颜欢笑 提交于 2019-12-24 04:32:17
问题 in primefaces there's the RequestContext class which add the ability to invoke javascript method from server side : RequestContext context = RequestContext.getCurrentInstance(); //execute javascript oncomplete context.execute("PrimeFaces.info('Hello from the Backing Bean');"); i was wondering if it's possible to accomplish that with jsf 2 without using primefaces, please advise. 回答1: The easiest but also hackiest way would be to set a property which represents the content of a <h:outputScript

File download from JSF with a rendered response

大兔子大兔子 提交于 2019-12-24 04:05:22
问题 I have some dynamically generated files which I want my JSF 2.0 app to download for the user. I've been able to get this working using the code found in the solution here : Forcing a save as dialogue from any web browser from JSF application and a command button in a form on the page And that works fine except for one hitch. I'd like to be able to render a message back to the user on the initial page that tells them their file is being processed and to please wait. Obviously the

Submitting form by hitting ENTER event in primefaces p:autoComplete

吃可爱长大的小学妹 提交于 2019-12-24 03:54:10
问题 Below is my code: <h:form> <p:autoComplete id="autoCompleteID" value="#{myBean.item}" completeMethod="#{myBean.completeMethod}" </p:autoComplete> <h:commandButton action="#{myBean.searchRelatedItems}"/> </h:form> Here my scenario is like standard Google search, I can see related Items in suggestion and also redirect another page based on text typed in p:autoComplete text field. Its works fine by click on Button, but I also want to achieve by hitting ENTER in p:autoComplete text field. 回答1: A

PrimeFaces: export chart as picture

谁说胖子不能爱 提交于 2019-12-24 03:47:06
问题 I'm trying to export my PF chart as picture following the showcase: enter link description here <h:form id="form1"> <p:chart type="line" value="#{chartView.lineModel1}" style="width:500px;height:300px" widgetVar="chart"/> <p:commandButton type="button" value="Export" icon="ui-icon-extlink" onclick="exportChart()"/> <p:dialog widgetVar="dlg" showEffect="fade" modal="true" header="Chart as an Image" resizable="false"> <p:outputPanel id="output" layout="block" style="width:500px;height:300px"/>

How to update a h:inputHidden with p:commandButton?

◇◆丶佛笑我妖孽 提交于 2019-12-24 03:34:29
问题 I writed an ajax request for any data. But the data don't work with h:inputHidden. I think it's a bug of Primefaces. But I don't know how to get the data now. code: <h:inputHidden id="buttonData" value="#{buttonDataBean.buttonData}" /> ... <p:commandButton id="getData" action="#{buttonAction.getButtonData}" update="buttonData" /> When I click the commandButton, the value of don't work. But if I use the h:outputText, it worked. My requirement: Before click the commandButton, I have create any

p:column header facet is not shown when rendered attribute is used on p:column

旧街凉风 提交于 2019-12-24 03:07:24
问题 I have a <p:dataTable> . I would like to render a <p:column> conditionally as follows: <p:dataTable value="#{abcList}" var="abc"> <p:column rendered="#{headerShow}"> <f:facet name="header"> <h:outputText value="header" /> </f:facet> <h:outputText value="#{abc.hijk}" /> </p:column> </p:dataTable> When #{headerShow} is false , then the column is hidden. When #{headerShow} is true , then the column is shown, but without header. When I hardcode rendered="true" , then the column is shown with

Detect when the multiupload primefaces componet ends all the uploads

若如初见. 提交于 2019-12-24 03:04:08
问题 I´m usig the jsf version 2.1 primefaces 5.1 and tomcat 7. I have to execute a managed bean method after the all the uploads has been succesfully in a multiple upload component, I used the onComplete atribute, but is executed after each upload. I need to do it after the all files upload was completed. How identify that? Thanks in advance for your time and answers PD I posted this question in the primefaces 1 forum but nobody answer. 回答1: This should work: <p:fileUpload ... oncomplete=

Including resources outside context root with JSF2

最后都变了- 提交于 2019-12-24 02:43:22
问题 I'm currently upgrading an application from JSF 1.2 and Richfaces 3.3 to JSF 2 and Richfaces 4. I'm having issues getting my application to include stylesheets using JSF2's new h:outputStylesheet component Here is my old code: <a4j:loadStyle src="resource:///com/testing/test/html/css/style.xcss" /> And here is what I have for my new code (Not working): <h:outputStylesheet library="resource:///com/testing/test/html/css/" name="style.xcss" /> I've tried various variations but none have worked.