facelets

How to use Facelets composition with files from another context

柔情痞子 提交于 2019-11-26 23:00:46
I have an application that use composition (for page templates). But we think in create a web-application (war) to host all templates shared by all applications in the same host of all applications. How I can include a template from another context? At this time I use import from http request. But it's sounds like bad. <ui:composition template="http://localhost:8080/templates/layout/foo.xhtml"> I'm using JBoss Seam 2.x with JSF 1. BalusC Note that this is to be done differently in JSF 2.x Facelets, see this answer for detail. This is possible with a custom Facelets resource resolver. I would

@Inject to pass params to a CDI @Named bean via URL

与世无争的帅哥 提交于 2019-11-26 22:55:29
If I cannot use the @ManagedProperty annotation with @Named, because @ManagedProperty doesn't work in CDI(?), then how do you pass params in the URL to the facelets client? In my code, I want to pass javax.mail.getMessageNumber() to details.xhtml through the "back" and "forward" buttons. I understand that @Inject should be used, but what is being injected and how, please? From the glassfish logs, id is always 0, which is quite odd. Even when "forward" is clicked, id never gets above 1 no matter how many times the button is clicked. Of course, that's merely a symptom of the problem. The desired

How can I set id of a component/tag inside ui:repeat

放肆的年华 提交于 2019-11-26 22:55:11
I'm trying to assign an id to a component inside a <ui:repeat> like that: <ui:repeat value="#{bean.columns}" var="column"> <h:panelGroup layout="block" id="column_#{column.id}" styleClass="#{column.id} dashboard_column"> The thing is that #{column.id} value is being placed properly inside the styleClass value but its not being set inside the id attribute. All that is being set inside the id attribute is the automatically generated id by the JSF + my hard coded value column_ . If I remove the hard coded column_ I get an exception: java.lang.IllegalArgumentException: component identifier must

Java EE6> Packaging JSF facelets (xhtml) and ManagedBeans as JAR

只愿长相守 提交于 2019-11-26 22:30:32
Is it possible to package JSF facelets and ManagedBeans into a JAR file? So that we can use this code and UI combination in different war/ear projects? I am not talking about JSF Components! If yes - can you point me to a tutorial or blog post I need details about the Jar structure and additional files needed in the Jar? Thanks Max BalusC Yes, that's definitely possible, assuming that you're using JSF 2.0, part of Java EE 6. As to the managed beans and other JSF classes like validators, converters, etc, just annotate them with @ManagedBean , @FacesValidator , @FacesConverter , etc and package

JSTL c:forEach causes @ViewScoped bean to invoke @PostConstruct on every request

我与影子孤独终老i 提交于 2019-11-26 20:59:30
问题 Again i see that the @PostConstruct is firing every time even though no binding attribute is used. See this code :- <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core"> <h:head> <title>Facelet Title</title> </h:head>

How can I access session attribute in Facelets page

孤人 提交于 2019-11-26 20:29:03
问题 I have implemented a login form using JSF and PrimeFaces. I used this example in the PrimeFaces showcase website. I have a Facelets page to show a dataTable. Now I need to integrate the above login form with this table page. So I added few lines in to LoginBean.java to handle session attribute. if (username.equals(getUsername_db()) && password.equals(getPassword_db())) {//valid user and paward loggedIn = true; msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Welcome", getUsername_db()); /

How to invalidate an user session when he logs twice with the same credentials

情到浓时终转凉″ 提交于 2019-11-26 20:21:21
I'm using JSF 1.2 with Richfaces and Facelets. I have an application with many session-scoped beans and some application beans. The user logs in with, let's say, Firefox. A session is created with ID="A"; Then he opens Chrome and logs in again with the same credentials. A session is created with ID="B". When the session "B" is created, I want to be able to destroy session "A". How to do that? Also. when the user in Firefox does anything, I want to be able to display a popup or some kind of notification saying "You have been logged out because you have logged in from somewhere else". I have a

Which XML namespace to use with JSF 2.2 and up

醉酒当歌 提交于 2019-11-26 19:05:40
I have migrated my application from JSF 1.2 to 2.2. It used XML namespaces on java.sun.com domain like xmlns:f="http://java.sun.com/jsf/core" . However, Oracle's Java EE 7 tutorial is using XML namespaces on xmlns.jcp.org domain like xmlns:f="http://xmlns.jcp.org/jsf/core" . Which one is recommended and why was this changed? BalusC Which one is recommended? Go ahead with XML namespaces on xmlns.jcp.org domain. This was newly introduced since Java EE 7 in 2013 (which covers a.o. JSF 2.2, Servlet 3.1, CDI 1.1, etc). Do note that this not only affects Facelets files, but also XML configuration

How to implement a dynamic list with a JSF 2.0 Composite Component?

余生颓废 提交于 2019-11-26 18:51:04
I asked this question and although the answer directly satisfied my needs I am left with a feeling that there has to a simpler solution for this specific problem. I would like to have a composite component that accepts a list of items (The type of the items agreed upon so the members can be used freely within the composite component) The CC (composite component) display the list of items and allows for addition and subtraction of items. I would like to do this in the most simple and efficient manner. To illustrate the problem, an example: The definition should be rather simple (unless of

Spring MVC with multiple view resolvers

允我心安 提交于 2019-11-26 18:19:31
问题 I tried to use 2 view resolvers: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www