Tiles 3 override a nested attribute - struts2

I'm have a problem with Tiles 3 with Struts2. I can't seem to override an attribute of a nested tiles-definition.
Here's the relevant parts of my web.xml:
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
Here's my struts.xml
<package name="helloworld" extends="tiles-default" namespace="/secure">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" default="true" />
</result-types>
<interceptors>
<interceptor name="s2sLogging" class="com.s2s.web.s2.S2Interceptor" />
<interceptor-stack name="s2sStack">
<interceptor-ref name="timer" />
<interceptor-ref name="defaultStack" />
<interceptor-ref name="s2sLogging" />
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="s2sStack" />
<action name="howitworks" class="com.s2s.web.s2.S2RootAction" >
<result name="success" type="tiles">.howItWorks.landing</result>
</action>
Here's my tiles.xml
<definition name="s2s.rightNav" template="/WEB-INF/s2/pages/common/rightNav.jsp" >
</definition>
<definition name="s2s.pageContent" template="/WEB-INF/s2/pages/pageContent.jsp">
<put-attribute name="box" value="true" /> <!-- change to false to remove grey box behind text -->
<put-attribute name="rightNav" value="s2s.rightNav" />
</definition>
<!-- overall page layout -->
<definition name="page.layout" template="/WEB-INF/s2/pages/page.jsp">
<put-attribute name="pageTitlePrefix" value="s2s.com" type="string"/>
<put-attribute name="pageTitle" value=" " type="string"/>
<put-attribute name="headContent" value="s2s.headContent" />
<put-attribute name="extraHeadContent" value=".tile.empty" />
<put-attribute name="topNav" value="s2s.topNav" />
<put-attribute name="topNavSubNav" value="s2s.topNavSubNav" />
<put-attribute name="pageContent" value="s2s.pageContent" />
<put-attribute name="footer" value="s2s.footer" type="string"/>
<put-attribute name="SEOkeywords" value="s2s, ship to storage, moving storage services, self-storage, moving storage, self storage shipping, send to storage, ship to self storage, shipping storage, mail storage, self storage pick up and delivery" />
<put-attribute name="SEOdescription" value="The worlds most convenient self-storage. s2s combines shipping, elf storage, and service -- prices from $2.79 a box. Boxes are picked up from your doorstep and stored at our climate controlled, secure warehouse. s2s's flexible pricing grows as your needs grow. A valuable shipping and storage resource for moving, relocation, offices, students, trade shows, and more." />
<put-attribute name="pageSEOkeywords" value=" " type="string"/>
<put-attribute name="pageSEOdescription" value="s2s.com - " type="string"/>
<put-attribute name="debugPage" value="v.101" type="string"/>
</definition>
<!-- PAGE DEFNINITIONS -->
<definition name=".howItWorks.landing" extends="page.layout">
<put-attribute name="pageTitle" value="How Mail Storage Works " type="string"/>
<put-attribute name="selectedTab" value="howItWorks" type="string"/>
<put-attribute name="pageSEOkeywords" value="how it works, " type="string"/>
<put-attribute name="pageSEOdescription" value="How It Works | " type="string"/>
<put-attribute name="rightNavCTAs" value="estimateBoxSize,helpfulLinks" type="string" cascade="true"/>
<put-attribute name="mainBodyContent" value="s2s.howItWorks.MainBodyContent" cascade="true"/>
</definition>
<definition name="s2s.howItWorks.MainBodyContent" template="/WEB-INF/s2/pages/howItWorks.jsp" />
I want to override the mainBodyContent and the rightNavCTAs attributes of with the definition of .howItWorks.landing. However, when I print out the actual value in the jsp , rightNavCTAs is null (and I think it means that the value is not propagating down even though I use cascade="true").
According to the Apache Tiles 3 documentation here, I should be able to nest using subdefinitions like I have above, and then extend and override attributes. The cascade is supposed to propagate attributes.
Needless to say, I can't get it to work. Can anyone spot my flaw?
as Requested, here are my jsps. thanks for looking.
all jsps have this at the top:
<%# page contentType="text/html; charset=UTF-8" %>
<%# taglib prefix="s" uri="/struts-tags" %>
<%# taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
Here is My page.jsp (stripped of css):
<tiles:importAttribute scope="request"/>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/stylesheet.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jmesa.css">
<title>
<tiles:getAsString name="pageTitlePrefix" /> - <tiles:getAsString name="pageTitle" />
</title>
<tiles:insertAttribute name="headContent" />
<tiles:insertAttribute name="extraHeadContent" />
</head>
<body>
<div id="page">
<tiles:insertAttribute name="topNav" />
<tiles:insertAttribute name="topNavSubNav" />
<tiles:insertAttribute name="pageContent" />
<tiles:insertAttribute name="footer" />
</div>
</body>
</html>
Here is may pageContent.jsp (stripped of css):
<table >
<tr>
<td >
<!-- Box Table Starts here-->
<s:if test="%{#attr['box'] == 'true'}">
<table >
<tr>
<td /></td>
<td /></td>
<td /></td>
</tr>
<tr>
<td > </td>
<td >
<!-- Insert Main Body Content1 -->
<tiles:insertAttribute name="mainBodyContent" />
<!-- End of Main Body Content1 -->
</td>
<td > </td>
</tr>
<tr>
<td /></td>
<td > </td>
<td /></td>
</tr>
</table>
</s:if>
<s:else>
<!-- Insert Main Body Content -->
<tiles:insertAttribute name="mainBodyContent" />
<!-- End of Main Body Content -->
</s:else>
</td>
<td > </td>
<td >
<tiles:insertAttribute name="rightNav" />
</td>
</tr>
</table>
<!-- End Page Content -->
And here is my howitworks.jsp (again, stripped of css). This is supposed to override the mainBodyContent attribute, but I can't get it to work :
<table >
<tr>
<td />Test... how it works</td>
<td /></td>
<td /></td>
</tr>
</table>

Related

How to modify the paths in struts-dojo and/or struts-jquery (Struts 2.3.20.1)?

here my development settings before I start with my problem:
Struts 2: 2.3.20.1
Tiles 2: 2.0.6
Struts2-DoJo-Plugin: 2.3.20.1
Struts2-JQuery-Plugin: 3.7.1
TomEE 7.0.55
Java 8: 1.8.0_25
IDE: IntelliJ 2016.2 Ultimate
Now my problem:
I want to use the DateTimePicker in Struts2-Dojo or *-JQuery, but for both API I get false paths in the generated HTML sides.
Look at these pictures what my results are:
Struts 2 - DOJO (1st Browser view, 2nd HTML src)
Struts 2 - JQuery (1st Browser view, 2nd HTML src)
You see my problem? The double dashes? Why did Struts that? Is that a problem with Tiles?
I need only one dash, I looked up on this community before on this link:
Relative Path in Struts 2 - DOJO
... and test this (you can see that under BaseLayout.jsp below) and it doesn't work for my problem.
Here my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>Struts Tiles 2 Demo</display-name>
<context-param>
<param-name>tilesDefinitions</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
The struts.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
<constant name="struts.devMode" value="false"/>
<!--suppress InjectedReferences -->
<package name="default" extends="struts-default" namespace="/">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
</result-types>
<default-action-ref name="start"/>
<action name="start">
<result name="success" type="tiles">index</result>
<result name="error" type="tiles">err404</result>
</action>
<action name="err404">
<result name="success" type="tiles">err404</result>
</action>
<action name="dbTest">
<result name="success" type="tiles">dbTest</result>
<result name="error" type="tiles">err404</result>
</action>
<action name="dtpJQ">
<result name="success" type="tiles">dtpJQ</result>
<result name="error" type="tiles">err404</result>
</action>
</package>
</struts>
The tiles.xml:
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="baseLayout" template="/WEB-INF/tiles/layouts/BaseLayout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/WEB-INF/tiles/parts/Header.jsp" />
<put-attribute name="menu" value="/WEB-INF/tiles/parts/Menu.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/WEB-INF/tiles/parts/Footer.jsp" />
<!-- only true or false -->
<put-attribute name="isDojoActive" value="false" />
<put-attribute name="isJQueryActive" value="false" />
</definition>
<definition name="index" extends="baseLayout">
<put-attribute name="title" value=".: 1st Steps Base Layout Struts 2 :." />
<put-attribute name="body" value="/WEB-INF/tiles/body/start.jsp" />
</definition>
<definition name="err404" extends="baseLayout">
<put-attribute name="title" value=".: Test Error 404 Page :." />
<put-attribute name="body" value="/WEB-INF/tiles/errorPages/404.jsp" />
</definition>
<definition name="dbTest" extends="baseLayout">
<put-attribute name="title" value=".: DB Test :." />
<put-attribute name="body" value="/WEB-INF/tiles/tableViews/dbTest.jsp" />
</definition>
<definition name="dtpTest" extends="baseLayout">
<put-attribute name="title" value=".: Date Time Picker Test - START :." />
<put-attribute name="body" value="/WEB-INF/tiles/body/testDTP.jsp" />
<put-attribute name="isDojoActive" value="true" />
</definition>
<definition name="dtpJQ" extends="baseLayout">
<put-attribute name="title" value=".: DTP JQ TEST :." />
<put-attribute name="body" value="/WEB-INF/tiles/modules/dateTimePickerJQuery.jsp" />
<put-attribute name="isJQueryActive" value="true" />
</definition>
<definition name="dateTimePicker" extends="baseLayout">
<put-attribute name="title" value=".: Date Time Picker Test :." />
<put-attribute name="body" value="/WEB-INF/tiles/modules/dateTimePicker.jsp" />
</definition>
</tiles-definitions>
BaseLayout.jsp:
<%#page contentType="text/html;charset=UTF-8" language="java" %>
<%#taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%#taglib prefix="s" uri="/struts-tags" %>
<%#taglib prefix="sx" uri="/struts-dojo-tags" %>
<%#taglib prefix="sj" uri="/struts-jquery-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><tiles:insertAttribute name="title" ignore="true" /></title>
<style type="text/css">#import url(/css/main.css);</style>
<s:set var="isDojoActive"><tiles:getAsString name="isDojoActive" /></s:set>
<s:set var="isJQueryActive"><tiles:getAsString name="isJQueryActive" /></s:set>
<s:if test='%{#isDojoActive.equals("true")}'>
<sx:head baseRelativePath="/struts/dojo" debug="true" parseContent="false" />
</s:if>
<s:if test='%{#isJQueryActive.equals("true")}'>
<sj:head />
</s:if>
</head>
<body>
<div class="container">
<div id="baseLeft"><tiles:insertAttribute name="menu" /></div>
<div id="baseRight">
<div class="inner-content header center"><tiles:insertAttribute name="header" /></div>
<div class="inner-content body"><tiles:insertAttribute name="body" /></div>
<div class="inner-content footer right"><tiles:insertAttribute name="footer" /></div>
</div>
</div>
</body>
</html>
I found the mistake:
My TomEE configuration under IntelliJ IDEA:
The missing root/application context.

p:dialog doesn't work as expected (freezes view or doesn't show required message)

After carrying on a project of a colleague of mine I'm facing some problems with a little dialogue. I was asked to copy a component and give it a new name. But there started the problem: I was able to build the dialogue and sending the component to my backing bean (unfortunately a SessionScoped one), also the new name found its way and saving is working too BUT the save button of my dialogue shows some weird behaviour. And as the code will show I have tried a lot of variants for it (with different results, described in the comments above them).
At the end I simply want three little things: get the JSF lifecycle only called once, a working required for my inputText-field and a still usable view after successful saving.
If you need more code e.g of the composite components starting with bal or of the backing bean, just drop a note and I will take care of it.
I'm aware of the fact that fetching the data every time from the database is bad style in ui:repeat, but I haven't seen a different way with the SessionScoped-Bean I have to work with (ViewScoped would for sure be better here, but time changing it, is, like always, not there).
Here is my code, using Primefaces 5.3 and the current version of Bootsfaces:
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:b="http://bootsfaces.net/ui"
xmlns:bal="http://java.sun.com/jsf/composite/bal/components">
<ui:composition template="/template/main.xhtml">
<ui:define name="content">
<bal:pageHeading title="#{msg.menu_settings} ยป #{msg.menu_components}">
<h:form>
<div class="btn-group pull-right">
<b:commandButton look="link" styleClass="as-link" size="lg" action="#{componentController.createCategory()}" value="#{msg.create_category}" title="#{msg.create_category}" iconAwesome="plus-circle" />
</div>
</h:form>
</bal:pageHeading>
<bal:row id="panelRow">
<h:form id="masterForm">
<ui:repeat value="#{componentController.getComponentcategoryListByCompany(loginController.company)}" var="componentcategory">
<bal:panel title="#{componentcategory.name}" description="#{componentcategory.description}" expanded="false" id="categoryForm">
<f:facet name="tools">
<b:commandButton look="link" styleClass="as-link" action="#{componentController.createComponent(componentcategory)}" value="#{msg.create_component}" title="#{msg.create_component}" size="md" iconAwesome="plus-circle" immediate="true" />
</f:facet>
<ul class="list-unstyled">
<ui:repeat value="#{componentcategory.componentList}" var="componentItem">
<li class="list-group-item">
<div class="row">
<div class="col-sm-7 name-col">#{componentItem.name}</div>
<div class="col-sm-5 text-right">
<b:buttonGroup>
<p:commandButton styleClass="btn btn-link as-link" style="float: left;" value="#{msg.copy_component}" title="#{msg.copy_component}" icon="fa fa-files-o" >
<p:ajax listener="#{componentController.sendComponentToCopy(componentItem)}" oncomplete="PF('copyComponentDialog').show()" process="panelRow:masterForm" partialSubmit="true" />
</p:commandButton>
</b:buttonGroup>
</div>
</div>
</li>
</ui:repeat>
<ui:fragment rendered="#{empty componentcategory.componentList}">
<li class="list-group-item list-group-item-info">#{msg.no_components_available}</li>
</ui:fragment>
</ul>
</bal:panel>
</ui:repeat>
<ui:fragment rendered="#{empty componentController.getComponentcategoryListByCompany(loginController.company)}">
<ul class="list-unstyled">
<li class="list-group-item list-group-item-info">#{msg.no_categories_available}</li>
</ul>
</ui:fragment>
</h:form>
</bal:row>
<p:dialog id="dlg" widgetVar="copyComponentDialog" resizable="false" draggable="false" showEffect="fade" hideEffect="fade" modal="true">
<h:form id="dlgForm" prependId="false">
<bal:panel id="copy_component_view" title="#{msg.copy_component}" styleClass="form-panel" collapsible="false">
<b:message for="name" showSummary="false"/>
<b:inputText value="#{componentController.copiedComponentName}" id="name" label="#{msg.name}" fieldSize="sm" required="true" requiredMessage="#{msg.name_required}" />
<bal:panel id="buttons">
<bal:row id="row" colStyleClass="btn-group">
<ui:remove>
<!-- Required works - After saving panels are no longer toggleable - JSF-lifecycle called twice -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check">
<p:ajax listener="#{componentController.copyComponent()}" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()" />
</p:commandButton>
<!-- Required doesn't work - After saving panels are toggleable, but view not updated - JSF-lifecycle called twice -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check" ajax="false">
<p:ajax listener="#{componentController.copyComponent()}" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()" />
</p:commandButton>
<!-- Required works - After saving panels are no longer toggleable - JSF-lifecycle called twice -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check" actionListener="#{componentController.copyComponent()}" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()" />
<!-- Required works - After saving panels are no longer toggleable - JSF-lifecycle called once -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check" action="#{componentController.copyComponent()}" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()" />
<!-- Required doesn't work - After saving panels are toggleable, view updated - JSF-lifecycle called once -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check" ajax="false" action="#{componentController.copyComponent()}" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()" />
<!-- Required works - After saving panels are no longer toggleable - JSF-lifecycle called once -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()">
<f:actionListener binding="#{componentController.copyComponent()}" />
</p:commandButton>
<!-- Required doesn't work - After saving panels are toggleable, view updated - JSF-lifecycle called once -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check" ajax="false" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()">
<f:actionListener binding="#{componentController.copyComponent()}" />
</p:commandButton>
<!-- Required works - After saving panels are no longer toggleable - JSF-lifecycle called once -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()">
<f:actionListener binding="#{componentController.copyComponent()}" />
</p:commandButton>
</ui:remove>
<!-- Required doesn't work- After saving panels are toggleable, view updated - JSF-lifecycle called once -->
<p:commandButton value="#{msg.save}" styleClass="btn btn-primary" icon="fa fa-check" ajax="false" actionListener="#{componentController.copyComponent()}" partialSubmit="true" process="copy_component_view" update="copy_component_view :panelRow:masterForm" oncomplete="if(!args.validationFailed) PF('copyComponentDialog').hide()" />
<b:commandButton value="#{msg.cancel}" iconAwesome="close" look="default" immediate="true" onclick="PF('copyComponentDialog').hide()" />
</bal:row>
</bal:panel>
</bal:panel>
</h:form>
</p:dialog>
</ui:define>
</ui:composition>
</html>
Edit:
Just some additional information concerning bal:panel:
<?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:cc="http://xmlns.jcp.org/jsf/composite"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
<!-- INTERFACE -->
<cc:interface>
<cc:attribute name="title" type="java.lang.String" />
<cc:attribute name="description" type="java.lang.String" />
<cc:attribute name="subtitle" type="java.lang.String" />
<cc:attribute name="subtitle" type="java.lang.String" />
<cc:attribute name="leftFooter" type="java.lang.String"/>
<cc:attribute name="rightFooter" type="java.lang.String" />
<cc:attribute name="closable" type="java.lang.Boolean" default="false" />
<cc:attribute name="collapsible" type="java.lang.Boolean" default="true" />
<cc:attribute name="expanded" type="java.lang.Boolean" default="true" />
<cc:attribute name="styleClass" type="java.lang.String" />
<cc:attribute name="style" type="java.lang.String" />
<cc:attribute name="titleStyle" type="java.lang.String" />
<cc:attribute name="labelValue" />
<cc:attribute name="labelLook" default="plain"/>
<cc:attribute name="labelStyleClass" />
<cc:attribute name="labelStyle" />
<cc:facet name="tools" />
</cc:interface>
<!-- IMPLEMENTATION -->
<cc:implementation>
<div id="#{cc.clientId}" class="ibox float-e-margins #{!cc.attrs.expanded?'border-bottom':''} #{cc.attrs.styleClass}" style="#{cc.attrs.style?cc.attrs.style:''}">
<ui:fragment rendered="#{not empty cc.attrs.title}">
<div class="ibox-title" style="#{not empty cc.attrs.titleStyle?cc.attrs.titleStyle:''}">
<span class="name-col">
<span>
<h5>#{cc.attrs.title}
<ui:fragment rendered="#{not empty cc.attrs.subtitle}">
<small class="m-l-sm">#{cc.attrs.subtitle}</small>
</ui:fragment>
<ui:fragment rendered="#{not empty cc.attrs.description}">
<h:outputLink value="" styleClass="ui-commandlink ui-widget btn-md">
<i class="fa fa-info-circle" data-toggle="tooltip" data-placement="auto" data-original-title="#{cc.attrs.description}" />
</h:outputLink>
</ui:fragment>
</h5>
<ui:fragment rendered="#{not empty cc.attrs.labelValue}">
<span class="label label-#{cc.attrs.labelLook} #{cc.attrs.labelStyleClass}" style="#{cc.attrs.labelStyle}">#{cc.attrs.labelValue}</span>
</ui:fragment>
</span>
</span>
<div class="ibox-tools">
<cc:renderFacet name="tools" />
<ui:fragment rendered="#{cc.attrs.collapsible eq true}">
<a class="collapse-link">
<i class="#{!cc.attrs.expanded?'fa fa-chevron-down':'fa fa-chevron-up'}"></i>
</a>
</ui:fragment>
<ui:fragment rendered="#{cc.attrs.closable eq true}">
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</ui:fragment>
</div>
</div>
</ui:fragment>
<c:if test="#{cc.childCount gt 0}">
<div class="ibox-content" style="display: #{!cc.attrs.expanded and cc.attrs.collapsible?'none':'block'};">
<cc:insertChildren />
</div>
</c:if>
<ui:fragment rendered="#{not empty cc.attrs.leftFooter or not empty cc.attrs.rightFooter}">
<div class="ibox-footer">
<ui:fragment rendered="#{not empty cc.attrs.rightFooter}">
<span class="pull-right">
#{cc.attrs.rightFooter}
</span>
</ui:fragment>
<ui:fragment rendered="#{not empty cc.attrs.leftFooter}">
#{cc.attrs.leftFooter}
</ui:fragment>
</div>
</ui:fragment>
</div>
</cc:implementation>
</html>
and bal:row:
<?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:cc="http://xmlns.jcp.org/jsf/composite">
<!-- INTERFACE -->
<cc:interface>
<cc:attribute name="colStyleClass" type="java.lang.String" />
<cc:attribute name="rowStyleClass" type="java.lang.String" />
</cc:interface>
<!-- IMPLEMENTATION -->
<cc:implementation>
<div id="#{cc.clientId}" class="row #{cc.attrs.rowStyleClass}" >
<div class="col-lg-12 #{cc.attrs.colStyleClass}">
<cc:insertChildren />
</div>
</div>
</cc:implementation>
</html>

<p:schedule> doesn't display in the presence of jquery

I'm trying to display a primefaces schedule on a xhtml page but this doesn't work.
As said in this question, i eliminated Components which uses Ajax and i noticed that
when i commented the link referencing the jquery file the schedual is displayed and it works fine but of course other jquery stop to work and i also got the following JS error :
TypeError: b3 is undefined # http://localhost:8080/theprojectname/javax.faces.resource/jquery/jquery.js.xhtml?ln=primefaces:14
When i uncomment the link for the jquery reference file the schedual isn't displayed and i got 2 JS errors :
TypeError: this.jq.mask is not a function # http://localhost:8080/theprojectname/javax.faces.resource/primefaces.js.xhtml?ln=primefaces:16
and :
TypeError: this.jqc.fullCalendar is not a function # http://localhost:8080/theprojectname/javax.faces.resource/schedule/schedule.js.xhtml?ln=primefaces:1
This have happened with the PF version 4.3.1 and the 5.3.
This is my index.xhtml :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" href="CSS/general.css" type="text/css" />
<link rel="stylesheet" href="CSS/jquery-ui-1.10.0.custom.min.css"
type="text/css" />
<!-- This is the jquery file reference link i've commented : -->
<!-- <script src="JS/jquery-1.8.3.js" /> -->
<script src="JS/jquery-ui-1.10.0.custom.js" />
<script src="JS/jquery.flip.js" />
<script src="JS/jquerygen.js" />
<title>my app</title>
<script>
//<![CDATA[
//]]>
</script>
</h:head>
<body>
<f:view>
<h:form id="form1">
<h:panelGroup id="windsarea" layout="block">
<h:panelGroup id="gesevntsincl" layout="block">
<p:growl id="messages" showDetail="true" />
<p:schedule id="schedule" value="#{scheduleController.eventModel}"
widgetVar="myschedule">
<p:ajax event="dateSelect"
listener="#{scheduleController.onDateSelect}"
update="eventDetails" oncomplete="eventDialog.show()" />
<p:ajax event="eventSelect"
listener="#{scheduleController.onEventSelect}"
update="eventDetails" oncomplete="eventDialog.show()" />
<p:ajax event="eventMove"
listener="#{scheduleController.onEventMove}" update="messages" />
<p:ajax event="eventResize"
listener="#{scheduleController.onEventResize}" update="messages" />
</p:schedule>
<p:dialog widgetVar="eventDialog" header="Event Details"
showEffect="clip" hideEffect="clip">
<h:panelGrid id="eventDetails" columns="2">
<h:outputLabel for="title" value="Title:" />
<p:inputText id="title" value="#{scheduleController.event.title}"
required="true" />
<h:outputLabel for="from" value="From:" />
<p:inputMask id="from"
value="#{scheduleController.event.startDate}" mask="99/99/9999">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:inputMask>
<h:outputLabel for="to" value="To:" />
<p:inputMask id="to" value="#{scheduleController.event.endDate}"
mask="99/99/9999">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:inputMask>
<h:outputLabel for="allDay" value="All Day:" />
<h:selectBooleanCheckbox id="allDay"
value="#{scheduleController.event.allDay}" />
<p:commandButton type="reset" value="Reset" />
<p:commandButton id="addButton" value="Save"
actionListener="#{scheduleController.addEvent}"
oncomplete="myschedule.update();eventDialog.hide();" />
</h:panelGrid>
</p:dialog>
</h:panelGroup>
</h:panelGroup>
<div id="tasksbar" />
<div id="startbutn" />
<h:panelGroup id="startmenudiv">
<h:panelGroup id="substartmenudiv" />
</h:panelGroup>
<div style="visibility: hidden;">
<BR />
<BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR />
<BR />
</div>
<div id="loginbackground" />
<div id="logindivflip">
<div id="logindiv">
<br />
<div class="hidden" style="font-weight: 900;">Welcome,please
authentificate :</div>
<br />
<div class="hidden">
<h:outputText value="login :" />
<h:inputText class="rounded" value="#{userBean.login}" />
</div>
<br /> <br />
<div class="hidden">
<h:outputText value="password :" />
<h:inputText class="rounded" value="#{userBean.pwd}" />
</div>
<br /> <br />
<div class="hidden">
<span class="ebbtn"> <a id="logsubmitbtn" href=""
title="Reset" onclick="">Submit <f:ajax event="click"
execute="#this" listener="#{userBean.verifierUserDsLdap}" />
</a> <a id="resetbtn" href="" title="Reset" onclick="">Reset</a>
</span>
</div>
</div>
<div id="loginphoto" />
</div>
<p:remoteCommand name="addNewWindow"
actionListener="#{userBean.addNewWindow}">
<f:param name="windowname" />
</p:remoteCommand>
<p:remoteCommand name="updatewinstylprops"
actionListener="#{userBean.updatewinstylprops}">
<f:param name="windowid" />
<f:param name="top" />
<f:param name="left" />
<f:param name="width" />
<f:param name="height" />
</p:remoteCommand>
</h:form>
</f:view>
</body>
</html>
Does someone have a clue please?
You should not include additionals jquerys into your pages, cause its already bundled with primefcaes...
Also , use h:outputScript instead of <script and h:outputStylesheet instead of link
So your js include should look like this (notice that I first included explicitly the jquery bundled with primefaces
<h:head>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<h:outputScript name="JS/jquery.flip.js" target="head" />
<h:outputScript name="JS/jquerygen.js" target="head" />
place you JS folder under the resources folder in your WebContent folder
You should also read this What is the JSF resource library for and how should it be used?

Components with <f:ajax> do not work when a <p:schedual> exists on the same page in JSF2

As said in this question's answer :
"Components which uses Ajax. If you don't need it, disable Ajax"
a p:schedual isn't displayed if there are others components with an f:ajax in the same page.
i noticed that if these components are written in the code after the schedual, the latter can be displayed but these components do not respond to user interactions anymore (I've an example of code in a previous question i've asked).
So, what if i "need them to work" ? is the schedual designed to work only alone and disable other components to share the ajax functionalities with it ?!
This the code in which i used the schedual :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link rel="stylesheet" href="CSS/general.css" type="text/css" />
<link rel="stylesheet" href="CSS/jquery-ui-1.10.0.custom.min.css"
type="text/css" />
<script src="JS/jquery-ui-1.10.0.custom.js" />
<script src="JS/jquery.flip.js" />
<script src="JS/jquerygen.js" />
<title>my app</title>
</h:head>
<body>
<f:view>
<h:form id="form1">
<h:panelGroup id="windsarea" layout="block">
<h:panelGroup id="gesevntsincl" layout="block">
<p:growl id="messages" showDetail="true" />
<p:schedule id="schedule" value="#{scheduleController.eventModel}"
widgetVar="myschedule">
<p:ajax event="dateSelect"
listener="#{scheduleController.onDateSelect}"
update="eventDetails" oncomplete="eventDialog.show()" />
<p:ajax event="eventSelect"
listener="#{scheduleController.onEventSelect}"
update="eventDetails" oncomplete="eventDialog.show()" />
<p:ajax event="eventMove"
listener="#{scheduleController.onEventMove}" update="messages" />
<p:ajax event="eventResize"
listener="#{scheduleController.onEventResize}" update="messages" />
</p:schedule>
<p:dialog widgetVar="eventDialog" header="Event Details"
showEffect="clip" hideEffect="clip">
<h:panelGrid id="eventDetails" columns="2">
<h:outputLabel for="title" value="Title:" />
<p:inputText id="title" value="#{scheduleController.event.title}"
required="true" />
<h:outputLabel for="from" value="From:" />
<p:inputMask id="from"
value="#{scheduleController.event.startDate}" mask="99/99/9999">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:inputMask>
<h:outputLabel for="to" value="To:" />
<p:inputMask id="to" value="#{scheduleController.event.endDate}"
mask="99/99/9999">
<f:convertDateTime pattern="dd/MM/yyyy" />
</p:inputMask>
<h:outputLabel for="allDay" value="All Day:" />
<h:selectBooleanCheckbox id="allDay"
value="#{scheduleController.event.allDay}" />
<p:commandButton type="reset" value="Reset" />
<p:commandButton id="addButton" value="Save"
actionListener="#{scheduleController.addEvent}"
oncomplete="myschedule.update();eventDialog.hide();" />
</h:panelGrid>
</p:dialog>
</h:panelGroup>
</h:panelGroup>
<div id="tasksbar" />
<div id="startbutn" />
<h:panelGroup id="startmenudiv">
<h:panelGroup id="substartmenudiv" />
</h:panelGroup>
<div style="visibility: hidden;">
<BR />
<BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR /> <BR />
<BR /> <BR /> <BR />
<BR />
</div>
<div id="loginbackground" />
<div id="logindivflip">
<div id="logindiv">
<br />
<div class="hidden" style="font-weight: 900;">Welcome,please
authentificate :</div>
<br />
<div class="hidden">
<h:outputText value="login :" />
<h:inputText class="rounded" value="#{userBean.login}" />
</div>
<br /> <br />
<div class="hidden">
<h:outputText value="password :" />
<h:inputText class="rounded" value="#{userBean.pwd}" />
</div>
<br /> <br />
<div class="hidden">
<span class="ebbtn"> <a id="logsubmitbtn" href=""
title="Reset" onclick="">Submit <f:ajax event="click"
execute="#this" listener="#{userBean.verifierUserDsLdap}" />
</a> <a id="resetbtn" href="" title="Reset" onclick="">Reset</a>
</span>
</div>
</div>
<div id="loginphoto" />
</div>
<p:remoteCommand name="addNewWindow"
actionListener="#{userBean.addNewWindow}">
<f:param name="windowname" />
</p:remoteCommand>
<p:remoteCommand name="updatewinstylprops"
actionListener="#{userBean.updatewinstylprops}">
<f:param name="windowid" />
<f:param name="top" />
<f:param name="left" />
<f:param name="width" />
<f:param name="height" />
</p:remoteCommand>
</h:form>
</f:view>
</body>
</html>
THanks for help!

Spring Security - Can't Login After Clicking Logout

I've added Spring Security to my application. I am able to login fine but after I click logout, I'm then unable to login again.
Here is my applicationContext-security.xml
<http auto-config="true" access-denied-page="/accessDenied.html">
<intercept-url pattern="/login.html*" filters="none"/>
<intercept-url pattern="/static/**" filters="none"/>
<intercept-url pattern="/**" access="ROLE_USER" />
<form-login login-page="/login.html"
authentication-failure-url="/login.html?login_error=1"
default-target-url="/search.html"/>
<logout logout-success-url="/login.html"/>
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="true"/>
</http>
<!--
Usernames/Passwords are
rod/koala
-->
<authentication-provider>
<password-encoder hash="md5"/>
<user-service>
<user name="rod" password="a564de63c2d0da68cf47586ee05984d7" authorities="ROLE_USER" />
</user-service>
Here is my login form:
<form method="post" action="j_spring_security_check">
<table>
<tr>
<td><label for="j_username">Username:</label></td>
<td>
<input type="text" name="j_username" id="j_username" size="20" maxlength="50"
<c:if test="${not empty param.login_error}">
value="<%= session.getAttribute(AuthenticationProcessingFilter.SPRING_SECURITY_LAST_USERNAME_KEY) %>"
</c:if>/>
</td>
</tr>
<tr>
<td><label for="j_password">Password:</label></td>
<td>
<input type="password" name="j_password" id="j_password" size="20" maxlength="50"/>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="checkbox" name="_spring_security_remember_me"/> Remember me on this computer.
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" class="button-submit" name="submit" value="Login">
</td>
</tr>
</table>
And my logout link points to:/j_spring_security_logout
UPDATE: (10.30.2009 09:44 EDT)
Some additional info, I enabled DEBUG level logging and can now see this in my console:
09:42:14 DEBUG [http-8080-1] (AbstractProcessingFilter.java:412) - Authentication request failed: org.springframework.security.concurrent.ConcurrentLoginException: Maximum sessions of 1 for this principal exceeded
It would seem that this line from my applicationContext-security.xml has something to do with it:
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="true"/>
I'm not sure why even if I've logged out that it thinks I've exceeded the max num of sessions.
Any help appreciated, thanks!
-aj
Actually, I just solved it. ;)
This listener was missing from my web.xml:
<listener>
<listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>
</listener>

Resources