That helps, yes, for navigation components I can definitely see that. My issue
would be that if we had:
Tiles.xml:
<definition name="myLayout" path="/visualComps/myLayout.jsp">
<put name="header" value="/visualComps/header.jsp" />
<put name="search" value="/visualComps/search.jsp" />
<put name="body" value="" />
<put name="footer" value="/visualComps/footer.jsp" />
</definition>
<definition name="/foo.tiles" extends="myLayout">
<put name="body" value="foo.jsp" />
</definition>
I had envisioned that all my controls that were in the actual foo.jsp (and each
subsequent page) would have to use a global navigation rule. Glad to hear that
I can still have:
<navigation-rule>
<from-view-id>/foo.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/foo-success.jsp</to-view-id>
</navigation-case>
</navigation-rule>
I was envisioning having to do:
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>foo-success</from-outcome>
<to-view-id>/foo-success.jsp</to-view-id>
</navigation-case>
</navigation-rule>
This will likely come out in a future mail to the list (I just joined
yesterday), but I'm getting IO errors (Connection Refused) when the Tiles
plugin tries to load /WEB-INF/tiles.xml. I'm going back and trying running the
sample MyFaces-tiles-example app to see if it has the same issue.
-----Original Message-----
From: Matthias Wessendorf [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 16, 2005 11:18 AM
To: MyFaces Discussion
Subject: Re: commandButton does not work with Tiles
Neal,
for instance you have navigation.jsp, that uses <h:commandLink
action="showBarPage" ...../> for navigation to other pages inside your app, so
you need faces-config.xml to realize that.
Now let's look at subviews (Tiles is the same, since a tile is embedded inside
a subview).
You have pages like:
-foo.jsp
-bar.jsp
-myPage.jsp
all off the include navigation.jsp as subview (eg.
<f:subview="navi"><jsp:include page="navigation.jsp"/></f:subview>
or with Tiles)
so each of that pages, *show* the navigation
if the foo.jsp is displayed(foo.jsf in browser), the view-id is "foo.jsp"
ok, if your faces-config navigation rule looks like:
<navigation-rule>
<from-view-id>/navigation.jsp</from-view-id>
<navigation-case>
<from-outcome>showBarPage</from-outcome>
<to-view-id>/bar.jsp</to-view-id>
</navigation-case>
</navigation-rule>
that does not work,
but if you have <from-view-id>/foo.jsp</from-view-id>
that will work.
ok, now let's look what happens when bar.jsf (view-id "bar.jsp") is shown in
the browser.
your navigation rules looks now:
<navigation-rule>
<from-view-id>/foo.jsp</from-view-id>
<navigation-case>
<from-outcome>showBarPage</from-outcome>
<to-view-id>/bar.jsp</to-view-id>
</navigation-case>
</navigation-rule>
yes, that doesn't work.
so add an other
<navigation-rule>
<from-view-id>/bar.jsp</from-view-id>
<navigation-case>
<from-outcome>showBarPage</from-outcome>
<to-view-id>/bar.jsp</to-view-id>
</navigation-case>
</navigation-rule>
that works.
Now you have two rules
<navigation-rule>
<from-view-id>/bar.jsp</from-view-id>
<navigation-case>
<from-outcome>showBarPage</from-outcome>
<to-view-id>/bar.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/foo.jsp</from-view-id>
<navigation-case>
<from-outcome>showBarPage</from-outcome>
<to-view-id>/bar.jsp</to-view-id>
</navigation-case>
</navigation-rule>
A navigation rule like the first we talked about won't work!
Only if you are interessted in viewing navigation.jsp (but navigation.jsp
couldn't be presented since it has no <f:view>, because it is designed to be a
*subview*
However, so instead of having two or more rules for the one navigation rule
(<h:commandLink action="showBarPage" ...../>) from navigation.jsp why not using
*global* one ?
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>showBarPage</from-outcome>
<to-view-id>/bar.jsp</to-view-id>
</navigation-case>
</navigation-rule>
I hope it was clear to you :)
-Matthias
Neal Haggard wrote:
> Matthias,
>
> I have a question about 'you must use "global" navigation rulez for
> command components'. Why was this decided? Why can't the sub-view find the
> view-id for the parent? I'm new to JSF, so please forgive any ignorance here.
>
> My group is trying to evaluate how to move to JSF and we thought we
> were going with MyFaces due to it's built-in tiles support. However, we're
> talking about a large application. I have a feeling trying to use
> global-navigation rules will not scale well as we get into the hundreds of
> pages.
>
> Neal
>
> -----Original Message-----
> From: Vinod Singh [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 16, 2005 12:10 AM
> To: MyFaces Discussion
> Subject: Re: commandButton does not work with Tiles
>
>
> Hi Matthias,
>
> Here I am saying that when I click on the submit button
> (<h:commandButton id="submit" action="#{Persister.saveClient}" value
>
>>="#{Message.client_submit_button}" />) then method
>>Persister.saveClient()
>
> is not called. If I use this page without tiles then this method is called.
>
> Thanks,
>
> Vinod
>
>
>
> Vinod,
>
> when you use Subviews (<f:subview/>)
>
> then you must use "global" navigation rulez for
>
> command components (commadnButton or commandLink)
>
> if you use something like:
>
> <h:commandButton id="submit" action="myoutcome" value
> ="#{Message.client_submit_button}" />
>
> you must have something like that in faces.-config.xml
>
>
>
> <navigation-rule>
> <from-view-id>*</from-view-id>
> <navigation-case>
> <from-outcome>myoutcome</from-outcome>
>
> <to-view-id>/myPageWithTiles.jsp</to-view-id>
> </navigation-case>
> </navigation-rule>
>
>
> HTH,
> Matthias
>
>
> Vinod Singh wrote:
>
>>Hi All,
>>
>>I have created a simple jsf page, when I acces this page without tiles
>
> then
>
>>everything works fine but with tiles control does not transfer to the
>>desired class specified in the action attribute of commandButton.
>>
>>Can anybody tell where I am wrong?
>>
>>Thanks,
>>
>>Vinod
>>
>>
>><%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib
>>uri="http://java.sun.com/jsf/core" prefix="f" %> <f:loadBundle
>>basename="Message" var="Message"/>
>>
>><f:view>
>><html>
>><head><title>Client</title></head>
>> <body>
>> <h:form id="clientForm">
>> <h:message for="clientForm" /><br />
>> <h:panelGrid columns="3">
>> <h:outputText value="#{Message.client_name_label}" />
>> <h:inputText id="client_id" value="#{Client.client_id}"
>>required
>
> ="
>
>>true">
>> <f:validateLength maximum="30" minimum="3" />
>> </h:inputText>
>> <h:message for="client_id" />
>>
>> <h:outputText value="#{Message.client_desc_label}" />
>> <h:inputText id="description" value="#{Client.description}"
>>required="true">
>> <f:validateLength maximum="50" minimum="1" />
>> </h:inputText>
>> <h:message for="description" />
>> <h:commandButton id="submit" action="#{Persister.saveClient}"
>
> value
>
>>="#{Message.client_submit_button}" />
>> </h:panelGrid>
>> </h:form>
>> </body>
>></html>
>></f:view>