jsf-2

JSF 2: Change rendered atribute of a component on phase listener

给你一囗甜甜゛ 提交于 2019-12-11 06:24:41
问题 Hy guys, In JSF 2 How can I change the rendered atribute of a h:InputText component using a PhaseListener. Before the jsf page be rendered I have to verify all id of the h:inputtexts, and after that I will change the atribute to be rendered or not. Am I clear? 回答1: On GET requests, the view root is not created yet during the before phase of the render response and during the after phase it's too late because the response is already been rendered and sent to the client. The view root is

Facelets custom function not found

我只是一个虾纸丫 提交于 2019-12-11 06:17:36
问题 I'm writing a simple custom function in Facelets with a sample method. The problem is that the JSF 2 application fails to locate that function. The error message is: /test.xhtml @15,73 rendered="#{test:isGranted('ONE_ROLE')}" Function 'test:isGranted' not found. I've been checking and rechecking and can't find the problem. Any comment here would be really appreciated as it's clear that I'm missing something (but it seems that the steps involved are really simple). Do you know if there are

Difference between a4j:commandLink and h:commandLink

做~自己de王妃 提交于 2019-12-11 06:16:27
问题 Title says everything. What is the difference between a4j:commandLink and h:commandLink? 回答1: From richfaces docs The <a4j:commandLink> component is very similar to the <h:commandLink> component, the only difference is that an Ajax form submit is generated on a click and it allows dynamic rerendering after a response comes back. It's not necessary to plug any support into the component, as Ajax support is already built in. More info about h:commandLink here and a4j here. Read both and you

Access Managed bean classes from a different project

徘徊边缘 提交于 2019-12-11 06:15:50
问题 I want to access a @ManagedBean from Project 2 in a different Project 1 , but it's value is always null . I tried to add a src/main/webapp/META-INF/faces-config.xml file to Project 2 , but it didn't help. Project 2 is added as a .jar in Project 1 . The issue I'm facing is that the .jar doesn't contain the META-INF/faces-config.xml file. How can I have this file correctly added to the .jar during my maven project build? 回答1: You need to place faces-config.xml in src/main/resources/META-INF .

@SessionScoped bean instantiated over and over [duplicate]

你离开我真会死。 提交于 2019-12-11 06:13:30
问题 This question already has an answer here : @SessionScoped bean looses scope and gets recreated all the time, fields become null (1 answer) Closed 4 years ago . Using PrimeFaces 5.10, JSF 2, and Wildfly, I am trying to get my xhtml page to interact with a single instance of a @SessionScoped bean with a PF poll component. Each time the poll calls the bean method, a new instance of the bean is created. I've tried @ViewScoped and @SessionScoped with no change in behavior. I've noticed other

File upload doesn't work with PrimeFaces 4.0, JSF Mojarra 2.2.3 and Wildfly Beta 1

时光怂恿深爱的人放手 提交于 2019-12-11 06:01:22
问题 I have a web application running on: Wildfly Beta 1 JSF Mojarra 2.2.3 (from Wildfly) Primefaces 4.0 rewrite-servlet-2.0.7.Final / rewrite-config-prettyfaces-2.0.7.Final commons-io-2.4 / commons-fileupload-1.3 And I have problem with file upload component (advanced and simple mode doesn't work, never print inside upload() ). Same is even run without rewrite-servlet-2.0.7.Final/rewrite-config-prettyfaces-2.0.7.Final libs. My upload.xhtml file: <h:form prependId="false" id="formLateralUpload"

Lifecycle of MQ Connection in JSF - Connection Closed

不问归期 提交于 2019-12-11 06:00:40
问题 I use JSF 2 an WebSphere MQ for Messaging (JMS). I want to know what's the best practice to open / close the QueueConnection? Should I use for each client session one connection and open it on (post-)construction and close it on (pre-) destruction like here? Or are there better ways to handle the connection? E.g. "Open EntityManager in View" Pattern for JDBC/JPA? 回答1: Avoid creating a new connection for each getMessage() invocation. Create one connection at construct time, save it as an

Trouble to display deployJava button on ajax rerender

﹥>﹥吖頭↗ 提交于 2019-12-11 05:56:26
问题 I'm having trouble displaying the deploy-java button on ajax rerender <h:form id="deployJavaForm" rendered="#{myBean.shouldRender}"> <h:outputScript library="js" name="http://java.com/js/deployJava.js" target="head" /> <script type="text/javascript"> deployJava.createWebStartLaunchButton('blah.jnlp', '1.7.0'); </script> </h:form> when myBean.shouldRender == true and the form is updated the only thing being displayed (on a white page) is the deployJava-button and the request is left hanging.

h:commandButton works from the second click

ぃ、小莉子 提交于 2019-12-11 05:52:34
问题 Here is my code: <h:form> <h:messages errorClass="errorMessage" infoClass="infoMessage" warnClass="warnMessage"></h:messages> <h:panelGroup id="login" layout="block" rendered="#{!securityBean.authorized}"> <h:outputText value="login:"/> <h:inputText id="username" value="#{securityBean.username}"/> <h:outputText value="password:"/> <h:inputSecret id="password" value="#{securityBean.password}"/> <h:commandButton value="login" action="#{securityBean.login}"/> </h:panelGroup> <h:panelGroup id=

where to put filter like logic in JSF2

可紊 提交于 2019-12-11 05:34:21
问题 I am currently banging my head where to put a common logic for some authorization stuff in my Java EE 6/JSF 2 webapp: I have the requirement, that all requests that come with a specific cookie should be redirected to another page. I considered 3 solutions: 1) use a servlet 3.0 filter (@WebFilter) this worked, i also could inject my managed beans there, but the managed beans require access to the faces externalContext, which at filter invocation time has not yet been set up, so i got NPE's