after a quick review, I saw you are using *only* subview in the
template and f:view in the content...

look at this *master* template

http://svn.apache.org/viewcvs.cgi/myfaces/tomahawk/trunk/examples/tiles/src/main/webapp/template/template.jsp?rev=369795&view=markup

It is from the mentioned Tiles-MyFaces sample ...

HTH



On 2/16/06, CHAMBAZ Alexandre <[EMAIL PROTECTED]> wrote:
> Hello,
>
> The thing is that if I use my managed bean in a single
> page is working fine but when I'm using it in tiles
> it's not working anymore.
> Yes the page that I'm redirecting to is in a tile too
> but I tried before in the same tiles just changing a
> tile of the tiles.
> I would be very thankfull if you could send some
> working code with tile JSF and managed Bean.
>
> Great Regards Everyone
>
> So there it is my code in details:
>
> faces-config.xml:
> <faces-config>
>
>   <application>
>
> <view-handler>org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl</view-handler>
>
> <message-bundle>resources.application</message-bundle>
>     <locale-config>
>       <default-locale>en</default-locale>
>     </locale-config>
>   </application>
>
>   <managed-bean>
>         <managed-bean-name>mairie</managed-bean-name>
>
> <managed-bean-class>com.metier.Mairie</managed-bean-class>
>         <managed-bean-scope>session</managed-bean-scope>
>   </managed-bean>
>
>   <managed-bean>
>
> <managed-bean-name>etablissement</managed-bean-name>
>
> <managed-bean-class>com.metier.Etablissement</managed-bean-class>
>         <managed-bean-scope>session</managed-bean-scope>
>   </managed-bean>
>
>   <navigation-rule>
>         <from-view-id>*</from-view-id>
>         <navigation-case>
>                 <from-outcome>navEtablissement</from-outcome>
>                 <to-view-id>/etablissement.tiles</to-view-id>
>         </navigation-case>
>
>         <navigation-case>
>                 <from-outcome>navMairie</from-outcome>
>                 <to-view-id>/mairie.tiles</to-view-id>
>         </navigation-case>
>
>         <navigation-case>
>                 <from-outcome>navDeclaration</from-outcome>
>                 <to-view-id>/declaration.tiles</to-view-id>
>         </navigation-case>
>   </navigation-rule>
>
>   <navigation-rule>
>         <from-view-id>/pages/bodyMairie.jsp</from-view-id>
>         <navigation-case>
>                 <from-action>#{mairie.addE}</from-action>
>                 <from-outcome>sucess</from-outcome>
>                 <to-view-id>/pages/bodyMairie.jsp</to-view-id>
>         </navigation-case>
>   </navigation-rule>
>
> </faces-config>
>
>
>
>
> and now the tiles-def.xml:
> <tiles-definitions>
>
>     <definition name="main.layout"
> path="/pages/template.jsp" >
>         <put name="header" value="/pages/header.jsp"
> />
>         <put name="footer" value="/pages/footer.jsp"
> />
>     </definition>
>
>     <definition name="accueil.tiles"
> extends="main.layout" >
>         <put name="menu" value="/pages/menu.jsp" />
>         <put name="body" value="/pages/body.jsp" />
>     </definition>
>
>         <definition name="mairie.tiles" extends="main.layout"
> >
>         <put name="menu" value="/pages/menu.jsp" />
>         <put name="body" value="/pages/bodyMairie.jsp"
> />
>     </definition>
>
>     <definition name="etablissement.tiles"
> extends="main.layout" >
>         <put name="menu" value="/pages/menu.jsp" />
>         <put name="body"
> value="/pages/bodyEtablissement.jsp" />
>     </definition>
>
>     <definition name="declaration.tiles"
> extends="main.layout" >
>         <put name="menu" value="/pages/menu.jsp" />
>         <put name="body"
> value="/pages/bodyDeclaration.jsp" />
>     </definition>
>
>     <definition name="toto.layout"
> path="/pages/templateEssai.jsp" >
>                 <put name="gauche" value="/pages/body.jsp" />
>         <put name="droite" value="/pages/body.jsp" />
>     </definition>
>
>     <definition name="toto2.layout"
> extends="toto.layout" >
>         <put name="gauche" value="/pages/body.jsp" />
>         <put name="droite" value="/pages/body.jsp" />
>     </definition>
> </tiles-definitions>
>
> the body of template.jsp:
> <body>
> <div id="dconteneur" class="dconteneur">
>   <div id="dmenu" class="dmenu">
>     <f:subview id="menu">
>       <tiles:insert attribute="menu" flush="false" />
>     </f:subview>
>   </div>
>
>    <div id="dheader" class="dheader">
>       <f:subview id="header">
>         <tiles:insert attribute="header"
> flush="false"/>
>       </f:subview>
>    </div>
>
>    <div id="dbody" class="dbody">
>      <f:subview id="content">
>         <tiles:insert attribute="body" flush="false"/>
>      </f:subview>
>   </div>
>
>   <div id="dfooter" class="dfooter">
>      <f:subview id="footer">
>         <tiles:insert attribute="footer"
> flush="false"/>
>      </f:subview>
>   </div>
>
> </div>
> </body>
>
> and finally bodyMairie.jsp the jsp in tile that make
> the call to the action to add an element to the
> dataTable:
> <%@ taglib uri="http://java.sun.com/jsf/html";
> prefix="h" %>
> <%@ taglib uri="http://java.sun.com/jsf/core";
> prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk";
> prefix="t" %>
>
> <f:view>
>         <h:form>
>                 <h:outputText value="#{mairie.nom}"/>
>
>                 <h:dataTable binding="#{mairie.dataTable}"
> value="#{mairie.listeEtablissement}" var="etab"
> border="1">
>                         <h:column>
>                                 <f:facet name="header">
>                                         <f:verbatim> Nom 
> Etablissement</f:verbatim>
>                                 </f:facet>
>                                 <h:outputText value="#{etab.nom}"/>
>                         </h:column>
>
>                         <h:column>
>                                 <f:facet name="header">
>                                         <f:verbatim> Raison 
> Sociale</f:verbatim>
>                                 </f:facet>
>                                 <h:outputText value="#{etab.raisonSociale}"/>
>                         </h:column>
>
>                         <h:column>
>                                 <f:facet name="header">
>                                         <f:verbatim> Numero Siret</f:verbatim>
>                                 </f:facet>
>                                 <h:outputText value="#{etab.numeroSiret}"/>
>                         </h:column>
>
>                         <h:column>
>                                 <f:facet name="header">
>                                         <f:verbatim> Supprimer</f:verbatim>
>                                 </f:facet>
>                                 <h:selectBooleanCheckbox
> binding="#{mairie.checkBox}"/>
>                         </h:column>
>
>                 </h:dataTable>
>
>         </h:form>
>
>         <h:commandLink id="lkE" action="#{mairie.addE}"
> immediate="true">
>                         <h:outputText value="Add"/>
>         </h:commandLink>
>
>
>
> </f:view>
>
>
>
> --- Marco Mistroni <[EMAIL PROTECTED]> a écrit :
>
> > Hello,
> >    i am using Tiles with JSF, and it works just
> > fine...
> > can you tell me what do you think is the problem?
> >
> > what about the page that you are redirecting to? is
> > it using a tiles
> > template?
> >
> > i can post privately some of my pages if you need
> > (or even the whole
> > app since i truns with in-memory database)
> >
> > regards
> >  marco
> >
> > On 2/16/06, CHAMBAZ Alexandre
> > <[EMAIL PROTECTED]> wrote:
> > >
> > > Thanks for all Matthias and Alexandre,
> > >
> > > Exactly what I was looking for. So it looks it
> > would
> > > be hard to do what I'm looking for, I think I
> > willl
> > > have to give up Tiles with JSF ;-(
> > >
> > > Extract of the presentation:
> > >
> > > Apache Tiles
> > > Things that can go wrong
> > >
> > > • Navigation rules are relative to the top viewId
> > > • Not the tile
> > > • Tool support is surprisingly thin
> > > • JSF backing beans can't see tiles
> > >
> > >
> > >
> > > --- Matthias Wessendorf <[EMAIL PROTECTED]> a
> > > écrit :
> > >
> > > > here goes the link
> > > >
> > > >
> > >
> >
> http://developers.sun.com/learning/javaoneonline/2005/webtier/TS-7853.pdf
> > > >
> > > >
> > > >
> > > > On 2/16/06, Alexandre Poitras
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > There is a lot of issues when using Tiles in
> > JSF
> > > > since Tiles is not a
> > > > > JSF component. Watch the "Extreme Reuse in
> > > > JavaServer Faces
> > > > > Technology" JavaOne 2005 presentation if you
> > want
> > > > to know what I'm
> > > > > talking about. You should use Facelets or
> > > > Shale-Clay instead.
> > > > >
> > > > > On 2/16/06, CHAMBAZ Alexandre
> > > > <[EMAIL PROTECTED]> wrote:
> > > > > > Thanks for you're help but still not
> > working. I
> > > > tried
> > > > > > a lot of different combination of navigation
> > > > rule but
> > > > > > it's never working. My problme is not
> > navigation
> > > > but
> > > > > > more in the action thing. I think I need to
> > > > force JSF
> > > > > > to send the action to a specific page, how
> > can I
> > > > do
> > > > > > that?
> > > > > >
> > > > > > Here is my faces-config.xml:
> > > > > > <navigation-rule>
> > > > > >         <from-view-id>*</from-view-id>
> > > > > >         <navigation-case>
> > > > > >
> > > > <from-outcome>navEtablissement</from-outcome>
> > > > > >
> > > > <to-view-id>/etablissement.tiles</to-view-id>
> > > > > >         </navigation-case>
> > > > > >
> > > > > >         <navigation-case>
> > > > > >
> > > > <from-outcome>navMairie</from-outcome>
> > > > > >
> > > > <to-view-id>/mairie.tiles</to-view-id>
> > > > > >         </navigation-case>
> > > > > >
> > > > > >         <navigation-case>
> > > > > >
> > > > <from-outcome>navDeclaration</from-outcome>
> > > > > >
> > > > <to-view-id>/declaration.tiles</to-view-id>
> > > > > >         </navigation-case>
> > > > > >   </navigation-rule>
> > > > > >
> > > > > > Here it's my command button in a jsf page of
> > my
> > > > > > tile(composed of 4 pages):
> > > > > > <h:commandLink id="lkE"
> > action="#{mairie.addE}"
> > > > > > immediate="true">
> > > > > >                         <h:outputText
> > > > value="Add"/>
> > > > > >         </h:commandLink>
> > > > > >
> > > > > > and here it's the method called of my
> > managed
> > > > bean
> > > > > > used:
> > > > > > public String addE() {
> > > > > >         .....
> > > > > >                 return "sucess";
> > > > > >         }
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --- Matthias Wessendorf
> > <[EMAIL PROTECTED]>
> > > > a
> > > > > > écrit :
> > > > > >
> > > > > > > fast shot,
> > > > > > >
> > > > > > > -suround your button w/ <h:form>
> > > > > > > -ensure that you are using *global*
> > navigation
> > > > like
> > > > > > >     <navigation-rule>
> > > > > > >         <from-view-id>*</from-view-id>
> > > > > > >         <navigation-case>
> > > > > > >
> > > > <from-outcome>nav_page1</from-outcome>
> > > > > > >
> > > > <to-view-id>/page1.jsp</to-view-id>
> > > > > > >         </navigation-case>
> > > > > > >         <navigation-case>
> > > > > > >
> > > > <from-outcome>nav_page2</from-outcome>
> > > > > > >
> > > > <to-view-id>/page2.jsp</to-view-id>
> > > > > > >         </navigation-case>
> > > > > > >         <navigation-case>
> > > > > > >
> > > > <from-outcome>nav_page3</from-outcome>
> > > > > > >
> > > > <to-view-id>/non-tile.jsp</to-view-id>
> > > > > > >         </navigation-case>
> > > > > > >         <navigation-case>
> > > > > > >
> > > > <from-outcome>nav_page4</from-outcome>
> > > > > > >
> > > > <to-view-id>/page4.jsp</to-view-id>
> > > > > > >         </navigation-case>
> > > > > > >     </navigation-rule>
> > > > > > >
> > > > > > >
> > > > > > > On 2/15/06, CHAMBAZ Alexandre
> > > > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > > > Hi everybody,
> > > > > > > >
> > > > > > > > I'm develloping a JSF Site with Tiles
> > (from
> > > > > > > Struts)
> > > > > > > > using   the Tomahawk (I'm new in JSF
> > > > programming
> > > > > > > >
> > > > > > >
> > > > > >
> > > >
> > >
> >
> )org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl
> > > > > > > > support. The tile thing is working well.
> > But
> > > > when
> > > > > > > I'm
> > > > > > > > doing action in a jsf (with a command
> > > > button) it's
> > > > > > > not
> > > > > > > > working.
> > > > > > > >
> > > > > > > > Here what I've got:
> > > > > > > >
> > > > > > > > body.jsp : <h:commandButton value="add"
> > > > > > > > action="#{bean.add}"/>
> > > > > > > > this page works well alone adding an
> > element
> > > > to a
> > > > > > > > table
> > > > > > > >
> >
> === message truncated ===
>
>
>
>
>
>
>
> ___________________________________________________________________________
> Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs 
> exceptionnels pour appeler la France et l'international.
> Téléchargez sur http://fr.messenger.yahoo.com
>


--
Matthias Wessendorf
Zülpicher Wall 12, 239
50674 Köln
http://www.wessendorf.net
mwessendorf-at-gmail-dot-com

Reply via email to