jsf-2

FullAjaxExceptionHandler does not redirect to error page after invalidated session

匆匆过客 提交于 2019-12-22 10:47:09
问题 I am having issues with the Omnifaces FullAjaxExceptionHandler (http://showcase.omnifaces.org/exceptionhandlers/FullAjaxExceptionHandler). It does not redirect to the specified error page after the session is invalidated. I have the following in my faces-config: <factory> <exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory> </factory> And the following in my web.xml: <error-page> <exception-type>javax.faces.application

JSF Chrome Save Password on Login form

怎甘沉沦 提交于 2019-12-22 10:39:28
问题 How do I get my JSF login page to prompt Chrome to save password? <h:form id="login-form" class="form login-form"> <h:outputLabel for="j_username" value="Email:" /> <p:inputText value="#{loginBean.j_username}" id="j_username" required="true"> </p:inputText> <h:outputLabel for="j_password" value="Password:" /> <h:inputSecret value="#{loginBean.j_password}" id="j_password" required="true"> <p:commandButton id="loginButton" value="Login" action="#{loginBean.login}" /> </h:form> 回答1: Turn off

PrintServiceLookup.lookupPrintService solution in JBoss AS 7

前提是你 提交于 2019-12-22 10:28:48
问题 I am trying to print a pdf document from my JSF web application. When I call the method findPrinter() from main method, PrintServices are found, but when I call this method from web page PrintService are not found. Code mentioned below.. public static void main(final String[] args) throws Exception { PrintTest printTest = new PrintTest(); printTest.findPrinter(); } public void findPrinter() { PrintService[] printServices = PrinterJob.lookupPrintServices(); System.out.println("Print Services

General handling of AJAX call error on client side

拟墨画扇 提交于 2019-12-22 10:03:54
问题 We have a JSF 2.2 application using PrimeFaces. Now, when an error occurs, I check for an AJAX request and deliver a partial response (as shown in BalusC's anwer to this question). But what is, if there's no server anymore to handle the error, e.g. due to connection loss? At the moment, just nothing happens, leaving the user puzzled. I found a hint in that question, which works, but I'd like to solve this in a general way, so that all AJAX calls which fail try to redirect to the start page -

Accessing attributes passed to extended PrimeFaces component

佐手、 提交于 2019-12-22 09:59:24
问题 I'm trying to create a custom component to extend PrimeFaces. I have a simple component called textInput under the test namespace that simply calls the PrimeFaces textInput component and prints out the value passed to an attribute named fieldClass and the names of any attributes passed if I pass fieldClass as a string: <test:textInput id="foo" fieldClass="field-foo" /> this is the result fieldClass = field-foo [com.sun.faces.facelets.MARK_ID, fieldClass] If I pass fieldClass as an expression

How to override Primefaces jQuery and css

浪子不回头ぞ 提交于 2019-12-22 09:53:22
问题 I am using PrimeFaces. As PrimeFaces uses its own jQuery, jqueryUI, jQuery-UI.css. I am using ui:composition. What i did i included a line in my template page like this layout.xhtml <h:head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> <ui:insert name="title">Login</ui:insert> </title> <ui:insert name="style"></ui:insert> </h:head> Then on my page i used something like this <h:body> <ui:composition template="./WEB-INF/templates/layout.xhtml"> <ui:define name=

Ajax support In h:selectOneMenu

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 09:49:44
问题 I have to call backend code as soon as one value is selected from drop-down list. I am using JSF 2.0. In JSF 1.2 I did it by using <a4j:support> in <h:selectOneMenu> , but I am not geting how to do it in JSF 2.0. 回答1: Use the <f:ajax> tag. It's much similar to the <a4j:support> . <h:selectOneMenu value="#{bean.selectedItem}"> <f:selectItems value="#{bean.selectItems}" /> <f:ajax listener="#{bean.valueChanged}" /> </h:selectOneMenu> with public void valueChanged() { // ... } The <f:ajax> has

How to bind value of dynamically created HtmlInputText component to bean property?

天涯浪子 提交于 2019-12-22 09:30:35
问题 How can I set dynamically a JSF dynamicPanelGrid with some components (e.g. some inputtexts) and then fetch their values and store them into the object and database? I have created a sample object model, a Facelets view with a "placeholder" for the dynamically generated HtmlPanelGrid and a backing bean where I create the HtmlPanelGrid instance and its components. Here is the code for each: The model: @Entity @Table(name = "imageviewer_crreviewerformdata") public class CRReviewerFormData

JSF 2 equivalent of IBM's hx:scriptCollector pre- and postRender

谁说我不能喝 提交于 2019-12-22 09:15:18
问题 I am migrating an old JSF application from WebSphere to JBoss: the old version uses an IBM implementation of JSF. My question concerns the following component: <hx:scriptCollector id="aScriptCollector" preRender="#{aBean.onPageLoadBegin}" postRender="#{aBean.onPageLoadEnd}"> To reproduce the preRender behavior in JSF 2 I use a binding for the form (s. here). My questions: 1) Do you know a trick for simulating postRender in JSF 2? 2) Do you think is the trick I am using for preRender "clean"?

oncomplete attribute of h:commandLink not invoked

拜拜、爱过 提交于 2019-12-22 08:59:57
问题 We are migrating from JSF 1.2 to JSF 2.2.6 along with RichFaces 4.5.2. Facing issues with the oncomplete not getting called. The JS function during onclick gets called, but JS in oncomplete does not get called. How is this caused and how can I solve it? <h:commandLink ... onclick="ed();" oncomplete="cEd(#{rowIndex});"> 回答1: There is indeed no such attribute in <h:commandLink> . You're most likely confusing with <a4j:commandLink> which does have that attribute. You've basically 2 options: Just