jsf-2

Primefaces Datatable filter values are lost after the datatable is refreshed

ぃ、小莉子 提交于 2019-12-18 13:09:18
问题 I am using JSF 2.0 and Primefaces 3.2. I have a main form with a datatable and a button on each row that brings up a dialog with another data table. The dialog has its own form. When the datatable row is selected in the dialog, i process the selection and then refresh the datatable in the main form. After the refresh all my filters on the main datatable are lost. Is there a way to remember the filter values? My JSF page <h:panelGroup id="mainTable"> <h:form id="mainForm" prependId="false"> <p

How to send data between views having a ViewScoped bean

久未见 提交于 2019-12-18 12:47:08
问题 Background: I have a ViewScoped bean with a field named someId I have a page, somePage.xhtml with an inputText and a commandLink The value of the inputText has a corresponding field in the bean named searchValue When I click the link a method in the bean redirects to another page called searchResult.xhtml that use the same bean as somePage (although not a requirement) Before rendering searchResult the bean needs to execute a search in the database, based on the value of the inputText and the

How to execute action on GET request with f:viewParam?

99封情书 提交于 2019-12-18 12:32:36
问题 I'm currently trying out sending the id of a record from one page to another page. So in the page 1, i have something like this : <p:column> <h:link value="#{rpb.map['transNum']}" outcome="TInput.xhtml"> <f:param name="id" value="#{rpb.map['id']}" /> </h:link> </p:column> and in the target page (TInput.xhtml), i have something like this to capture the id : .... xmlns:fn="http://java.sun.com/jsp/jstl/functions"> <f:metadata> <f:viewParam name="id" value="#{tInputBean.id}"></f:viewParam> </f

How can I do Spring Security authentication from within a JSF form

孤街浪徒 提交于 2019-12-18 12:06:10
问题 I created a simple JSF login page, and I'm trying to integrate it with spring security. Here is the form element from login.xhtml <h:form> <h:outputLabel value="User Id:" for="userId"/> <h:inputText id="j_username" label="User Id" required="true" value="#{loginBean.name}" > </h:inputText> <h:outputLabel value="Password: " for ="password"/> <h:inputSecret id="j_password" value="#{loginBean.password}" /> <h:commandButton value="Submit" action="#{j_spring_security_check}" /> </h:form> But the

Highlight an inputText in JSF when a validation error occurs

一曲冷凌霜 提交于 2019-12-18 11:56:09
问题 I have a form with a lot of inputText, what I want is to highlight those who are not being filled with correct data. I tried to use 'component.valid' but it always return that the field is invalid (i.e. fields are always red). this is the code : <h:inputText value="#{creerPersonne1.nom}" id="nom" style="#{not nom.valid ? 'border-color:red;' : 'border-color:black;'}"> <f:validateRegex pattern="^[a-zA-Z]+$"></f:validateRegex> </h:inputText> this is the result : note that the field is also

JSF CDI : Conversation scope bean[s] best practice

夙愿已清 提交于 2019-12-18 11:55:25
问题 I'm currently learning about JSF 2.0 and im so glad for the existence of this conversation scope feature, which is very helpful in opening a new tab or a new window on the same page and having separate resources, not overriding one another. But im curious on how to implement this in a good way, about when to start the conversation and when to close it. In my case, i have each CDI bean for each JSF page. And let's say that i have a menu, and when it's clicked, this will lead to page A, and

How to pass a action string into a JSF 2 composite component?

☆樱花仙子☆ 提交于 2019-12-18 11:54:10
问题 I'm creating a simple menuing composite component in JSF 2. However, I am unable to pass a String attribute into the composite component to use in the action attribute of the <h:commandLink>. My component looks like: <composite:interface> <composite:attribute name="title" required="true" type="java.lang.String"/> <composite:attribute name="view" required="true" /> </composite:interface> <!--implementation--> <composite:implementation> <li><h:commandLink action="#{cc.attrs.view}" value="#{cc

How to add a message to a specific component from JSF backing bean

送分小仙女□ 提交于 2019-12-18 11:49:13
问题 I have an h:inputText and an h:message connected to it: <h:inputText id="myText" value="#{myController.myText}" /> <a4j:outputPanel> <h:message for="myText" .../> </a4j:outputPanel> I want to send a message to it from java, in a manner like: FacesContext.getCurrentInstance().addMessage(arg0, arg1); which is sent to h:messages, but to a specific id in a specific form. How can I do this? (Without implementing validation bean or validation method - meaning without throwing validation exception).

JSF 2.0 Accessing Application Scope bean from another Bean

不想你离开。 提交于 2019-12-18 11:42:39
问题 I am using jsf 2.0 and I have two bean Navigation (Application Scope ) and Module (Request Scope). I want to use methods of Navigation bean in Module Bean. I am doing in this way In Module Bean @ManagedProperty(value = "#{navigationBean}") private NavigationBean navigationBean; But when I am trying to get navigationBean.SomeMethod it is not working as navigation bean is null . How to do this? 回答1: The both beans needs to be a fullworthy @ManagedBean . The acceptor should have a public setter

faces-redirect and the back button cause other links to work incorrectly

送分小仙女□ 提交于 2019-12-18 11:13:38
问题 I have a question surrounding faces navigation. So I have a page that takes a request parameter to load a specific user. This page displays a list of commandLink that, when clicked, redirect to another page using implicit navigation. The user is loaded by calling a method in a "preRenderView". The page that we redirect to also takes a request parameter to determine which case to load. The page is also using a preRenderView. Both pages have beans that are view scoped. This all works awesome