jsf-2

setStyleClass method is overriding the already defined styleClass

僤鯓⒐⒋嵵緔 提交于 2019-12-12 00:32:25
问题 I have a jsf code like this: <h:inputText id="emailText" styleClass="emailAddress" value="{bean.emailText}"/> I am adding the style emailAddress to use it in jquery for restricting the user from copying and pasting text in textbox like below: jQuery(".emailAddress").bind("copy paste",function(e) { e.preventDefault(); }); But on click of Submit, when the text field is validated and if the text entered is in improper format, bean side, I am adding another style class to the textbox to highlight

How to choose the right bean scope?

好久不见. 提交于 2019-12-12 00:26:24
问题 I noticed that there are different bean scopes like: @RequestScoped @ViewScoped @FlowScoped @SessionScoped @ApplicationScoped What is the purpose of each? How do I choose a proper scope for my bean? 回答1: Introduction It represents the scope (the lifetime) of the bean. This is easier to understand if you are familiar with "under the covers" working of a basic servlet web application: How do servlets work? Instantiation, sessions, shared variables and multithreading. @Request/View/Flow/Session

Disabling items with PrimeFaces SelectOneMenu with custom content / p:column

一个人想着一个人 提交于 2019-12-12 00:08:00
问题 it seems as if it is not possible to disable items in a SelectOneMenu from PrimeFaces (3.3) when using the custom content (as shown at http://www.primefaces.org/showcase-labs/ui/selectOneMenu.jsf). The testcase is simple, just take the following: <h:form> <p:selectOneMenu value="#{testBean.selected}"> <f:selectItems value="#{testBean.options}" var="t" itemLabel="#{t.label}" itemValue="#{t}" itemDisabled="#{t.value % 2 == 0 ? 'true' : 'false'}" /> </p:selectOneMenu> <p:selectOneMenu value="#

JSF Navigation Rule to the page itself

送分小仙女□ 提交于 2019-12-11 23:35:23
问题 How can I define a navigation rule from all view-ids from #{current.doLogout} to the same view-id? 回答1: If you don't define any or return null or void in action method, it will by default display the same page as where the form is been submitted. public void doLogout() { // Logout. } This way you don't need to fiddle with navigation cases in faces-config.xml . Are you by the way already aware of the new JSF 2.0 "implicit navigation" feature? 回答2: You need to use wildcards to achieve this Just

OpenSessionInViewFilter +Redirect in JSF

空扰寡人 提交于 2019-12-11 23:32:45
问题 I have JSF 2.1 application uisng Spring and Hibernate. In order to solve LazyLoading problem I'm using OpenSessionInView Filter. <filter> <filter-name>openSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>openSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> Everything works fine my lazy classes are initiated, but when I'm using Navigation

JSF- <h:commandButton> does not invoke new window from backing bean

一笑奈何 提交于 2019-12-11 22:43:59
问题 MY issue is similar to this issue I am having an in XHTML and it calls the backing bean method for invoking a new window with an pre constructed URL.But my problem is its not opening the URL. My code in the XHTML is given below <h:commandButton style="margin-left:1em;width: auto; height: 20px;font-size:85%" value="WebPhone" id="lwebpne"rendered="#{Bean.editCmdActionflg == true and (Bean.selectedSearchSysDetRow.isfeed != '1' or Bean.selectedOverviewDetails.webPheFlg == false)}"actionListener="

Implicit expression language object “component” not working in jsf 2.2.6

可紊 提交于 2019-12-11 22:22:12
问题 I'm migrating a jsf 2.0 application to jsf 2.2.6. There is a extensive use of implicit EL object component as styleClass="#{component.valid?'':'err'}". In jsf 2.2.6 (jsf-impl-2.2.6-jbossorg-4.jar) valid is not recognized, throwing "ServletException: The class 'javax.faces.component.html.xxx' does not have the property 'valid". Is this functionality deprecated in jsf 2.x.x? Can be related to JBoss EL? 回答1: It seems that you trying the component.valid on element that does not support it at all,

How to use JNDI with the tc server and postgresql in STS? (Unable to create initial connections of pool.)

核能气质少年 提交于 2019-12-11 22:13:50
问题 I want to use JPA/JNDI, as my experience with Netbeans and Glassfish has been that I could configure database settings at the server and so I'd be able to publish to different servers without changing anything in the code or configuration. I don't really get what's wrong and paste my configuration here in the hope that you can help me with some advice. I successfully tried to get a database connection with this persistence unit: <persistence-unit name="primefaces-showcase" transaction-type=

Iterating and asigning with LinkedHashMap

∥☆過路亽.° 提交于 2019-12-11 21:32:38
问题 I have LinkedHashMap<String,List<SelectItem>> results = got the results from DB see here I need to assign the above results to the lists available in UI using for loop. for (Map.Entry<String, List<SelectItem>> entry : results.entrySet()) { String key = entry.getKey(); List<SelectItem> values = entry.getValue(); System.out.println("Key = " + key); System.out.println("Values = " + values + "n"); } Assigning part example : if(key.equalsIgnoreCase("getProjectManager")) { tempselectedProjMgrList =

Rich Faces dataTable StyleClass Issue

时间秒杀一切 提交于 2019-12-11 21:32:07
问题 Version : Apache MyFaces 2.1.14 Rich Faces 4.3.5 Issue : We are migrating from JSF1.2 to JSF2. The issue is the style for headerClass is not getting applied correctly for rich:dataTable. When debugged , it seems that rich faces overrides the headerClass style with its own styles. The syle selector .rf-dt-hdr-c of rich faces overrides the custom style sheet selector. (We want to replace the colour of header with custom header image) Finally , when rich faces supplied style (.rf-dt-hdr-c) is