jsf-2

Why should I use createComponent instead of creating the instance myself?

隐身守侯 提交于 2019-12-18 05:00:35
问题 This is more of a conceptual question. I had to work on a functionality that had to create a dynamic h:dataTable . And whenever I created a component, I did something similar to this: DataTable table = (DataTable) FacesContext.getCurrentInstance().getApplication() .createComponent(DataTable.COMPONENT_TYPE); Using the FacesContext to create everything for me. However I could just as simply have done this: DataTable table = new DataTable(); The reason I did it in the first way is that all the

p:datatable loses sort column and order after ajax refresh

邮差的信 提交于 2019-12-18 04:44:13
问题 I have a button on a page that causes my data table to refresh via an AJAX request. Something like this: <h:form id="datatable"> <p:dataTable/> </h:form> <p:commandButton update=":datatable"> This is all fine an dandy except that when the table is refreshed it reverts to not sorting anything while still showing that it's sorting based on the previous value. In other words, the header is still highlighted and the arrow is still pointing in the sort direction but no sort is actually being

Test if ui:insert has been defined in the template client

99封情书 提交于 2019-12-18 04:39:18
问题 I am wondering if it is possible to know if ui:insert was defined in the ui:composition . I know that I can do it using separate ui:param , but just wanted to do it without in order to keep it simple and less error prone. Example : Template ... <ui:insert name="sidebar" /> <!-- Conditionnaly set the class according if sidebar is present or not --> <div class="#{sidebar is defined ? 'with-sidebar' : 'without-sidebar'}"> <ui:insert name="page-content" /> </div> ... Page 1 ... <ui:define name=

<f:ajax> Unable to attach <f:ajax> to non-ClientBehaviorHolder parent

♀尐吖头ヾ 提交于 2019-12-18 04:36:08
问题 I receive the following error when running my application: <f:ajax> Unable to attach <f:ajax> to non-ClientBehaviorHolder parent My JSF: <h:commandButton id="submitschool" action="submit" value="Get templates" style="FONT-SIZE: medium;FONT-FAMILY: 'Rockwell';width : 128px; height : 24px;"> <ui:repeat value="#{person.theImage}" var="item"> <f:ajax event="change" render="image" /> <h:graphicImage id="image" value="#{item}"/> </ui:repeat> </h:commandButton> I'm trying to return back elements in

Extended @FacesComponent as composite interface componentType renders nothing

纵饮孤独 提交于 2019-12-18 04:28:10
问题 I'm trying to extend JSF's component class (let it be one of h:panelGroup ) and render it via composite component: Step 1: @FacesComponent(value="customPanel") public class CustomPanel extends HtmlPanelGroup { // or UIPanel } Step 2: <!-- INTERFACE --> <composite:interface componentType="customPanel"/> <!-- IMPLEMENTATION --> <composite:implementation> <h:outputText value="Some text:"/> <composite:insertChildren/> </composite:implementation> And step 3: <xyz:panel>Hello world!</xyz:panel>

JSF2 Static resource caching

懵懂的女人 提交于 2019-12-18 04:24:12
问题 Glassfish 3.1.2, Mojarra 2.1.6, SSL activated I have an question about static resource caching. I´ve read some posts about this but I´m not sure which options we should use. This https://developers.google.com/speed/docs/best-practices/caching is also an good article about resource caching. Within our application server SSL is activated. We see that static resources (images, scripts, css) are not cached. Here is my test filter: @Override public void doFilter(ServletRequest request,

Initial sortorder for PrimeFaces datatable with multisort

情到浓时终转凉″ 提交于 2019-12-18 04:11:29
问题 I am trying to implement multisort on Primeface datatable. We are using Primefaces v3.5. I have created a new load method in the LazyLoadClass that takes the List of SortMeta> parameter. But I am having issues in the initial load of the table. The List of SortMeta> is null when the load method is called. I have also tried without specifying the initial sortBy and sortOrder for the datatable. In both the cases the result is the same. Seeing that we have this new class SortMeta to support

How to @Inject in a PhaseListener

雨燕双飞 提交于 2019-12-18 04:08:34
问题 I have added a PhaseListener to faces-config.xml : <lifecycle> <phase-listener>com.project.NotificationListener</phase-listener> </lifecycle> The class seems to be otherwise correct as it is pretty simple. public class NotificationListener implements PhaseListener { @Inject private MyCDIStuff stuff; @Override public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; } @Override public void beforePhase(PhaseEvent event) { this.stuff.doStuff(); } } The 'beforePhase' method gets called

How to cleanly end a CDI @ConversationScoped

与世无争的帅哥 提交于 2019-12-18 03:48:24
问题 My Project is using JSF2.0 and CDI. For one page, I want my backing bean to match the lifespan of the page. @ViewScoped seems a perfect fit but it's not part of CDI and then make our solution not consistent. Then my next option would be the CDI @ConversationScoped. Seems to me the only way to mark the boundary of a conversation is the program way via conversation.begin and conversation.end (I have used Seam 2.x, there you can use annotations to mark conversation boundary). My page is sitting

Injecting Beans in JSF 2.0

南笙酒味 提交于 2019-12-18 03:45:58
问题 I have a Session scoped bean import javax.faces.bean.SessionScoped; import javax.inject.Named; @Named @SessionScoped public class SessionBean implements Serializable{ I inyect the object in one Filter... public class FiltroSeguridad implements Filter{ @Inject private SessionBean sessionBean; @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request;