You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by dancantong <da...@hotmail.com> on 2008/02/27 17:42:43 UTC

Problems with page navigation

Hi!
I'm new to JSF and I'm experiencing problems with page navigation.
I'm developing a web application with MyFaces and ICEFaces.

I have a page with an ICEFaces table. On the table there is an output link
that point to an action that returns a navigation view name. When I click on
it, it goes to that page as expected. In that page there is a button to
return to the previous page. I've pointed it to an action that returns a
navigation name to the previous page.
The first problem I have is that when I click the button, it goes to the
previous page but it doesn't load properly some <link href> CSS stylesheets
I have in that page. I've set that links to relative addresses like

<link href="../styles.css" rel="stylesheet" type="text/css"></link> and are
loaded perfectly the first time I go directly to it, but fails when I click
on the button on the other page. If I click refresh on the browser the page
is loaded correctly.
Second is that when I click on the link button and go to the page, if I
click on the table to repeat the process, now the view it's not redirected
like before. It stays on the same page.

Here is an extract of my faces-config.xml


<navigation-rule>
		<from-view-id>/clients/show_clients.jsp</from-view-id>
		<navigation-case><from-outcome>update</from-outcome>
			
			<to-view-id>/clients/update_client.jsp</to-view-id>
		</navigation-case></navigation-rule>
	<navigation-rule>
		<from-view-id>/clients/update_client.jsp</from-view-id>
		<navigation-case>
			<from-outcome>added</from-outcome>
			<to-view-id>/clients/show_clients.jsp</to-view-id>
		</navigation-case>
		<navigation-case><from-outcome>return</from-outcome>
			
			<to-view-id>/clients/show_clients.jsp</to-view-id>
		</navigation-case></navigation-rule>
	
show_clients.jsp is the first page with the table. When I click on the table
it goes to update_client.jsp.
Then on update_client if I click on return it goes to show_client.jsp.

I'm getting mad with this.
Could anyone help me?

Thanks a lot.




-- 
View this message in context: http://www.nabble.com/Problems-with-page-navigation-tp15717275p15717275.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Problems with page navigation

Posted by Scott O'Bryan <da...@gmail.com>.
Hey Ted, I've actually had good luck using javascript to copy things 
into the head.  It just needs to be done before the page has finished 
loading.  I assume that's where the issue lies since icefaces has 
already loaded the page and is doing an XMLHttpRequest.

Scott

Ted Goddard wrote:
>
> Are the CSS links in the HEAD section of the document?
> During non-redirect navigation, ICEfaces 1.6 replaces
> only the body of the document.  (ICEfaces 1.7 performs
> a full page refresh if the HEAD changes; there is
> no way to reliably update the HEAD from JavaScript
> in current browsers.)
>
> You may also be encountering a bug in the <from-view-id>
> representation (before and after the filename has been
> transformed by the servlet mapping).  If you are using
> the .iface extension, please try adding either additional
> navigation rules with .iface, or eliminating the
> <from-view-id> condition.
>
> Regards,
> Ted.
>
> On 27-Feb-08, at 9:42 AM, dancantong wrote:
>
>>
>> Hi!
>> I'm new to JSF and I'm experiencing problems with page navigation.
>> I'm developing a web application with MyFaces and ICEFaces.
>>
>> I have a page with an ICEFaces table. On the table there is an output 
>> link
>> that point to an action that returns a navigation view name. When I 
>> click on
>> it, it goes to that page as expected. In that page there is a button to
>> return to the previous page. I've pointed it to an action that returns a
>> navigation name to the previous page.
>> The first problem I have is that when I click the button, it goes to the
>> previous page but it doesn't load properly some <link href> CSS 
>> stylesheets
>> I have in that page. I've set that links to relative addresses like
>>
>> <link href="../styles.css" rel="stylesheet" type="text/css"></link> 
>> and are
>> loaded perfectly the first time I go directly to it, but fails when I 
>> click
>> on the button on the other page. If I click refresh on the browser 
>> the page
>> is loaded correctly.
>> Second is that when I click on the link button and go to the page, if I
>> click on the table to repeat the process, now the view it's not 
>> redirected
>> like before. It stays on the same page.
>>
>> Here is an extract of my faces-config.xml
>>
>>
>> <navigation-rule>
>>         <from-view-id>/clients/show_clients.jsp</from-view-id>
>>         <navigation-case><from-outcome>update</from-outcome>
>>            
>>             <to-view-id>/clients/update_client.jsp</to-view-id>
>>         </navigation-case></navigation-rule>
>>     <navigation-rule>
>>         <from-view-id>/clients/update_client.jsp</from-view-id>
>>         <navigation-case>
>>             <from-outcome>added</from-outcome>
>>             <to-view-id>/clients/show_clients.jsp</to-view-id>
>>         </navigation-case>
>>         <navigation-case><from-outcome>return</from-outcome>
>>            
>>             <to-view-id>/clients/show_clients.jsp</to-view-id>
>>         </navigation-case></navigation-rule>
>>     
>> show_clients.jsp is the first page with the table. When I click on 
>> the table
>> it goes to update_client.jsp.
>> Then on update_client if I click on return it goes to show_client.jsp.
>>
>> I'm getting mad with this.
>> Could anyone help me?
>>
>> Thanks a lot.
>>
>>
>>
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Problems-with-page-navigation-tp15717275p15717275.html 
>>
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>
>


Re: Problems with page navigation

Posted by Ted Goddard <te...@icesoft.com>.
Are the CSS links in the HEAD section of the document?
During non-redirect navigation, ICEfaces 1.6 replaces
only the body of the document.  (ICEfaces 1.7 performs
a full page refresh if the HEAD changes; there is
no way to reliably update the HEAD from JavaScript
in current browsers.)

You may also be encountering a bug in the <from-view-id>
representation (before and after the filename has been
transformed by the servlet mapping).  If you are using
the .iface extension, please try adding either additional
navigation rules with .iface, or eliminating the
<from-view-id> condition.

Regards,
Ted.

On 27-Feb-08, at 9:42 AM, dancantong wrote:

>
> Hi!
> I'm new to JSF and I'm experiencing problems with page navigation.
> I'm developing a web application with MyFaces and ICEFaces.
>
> I have a page with an ICEFaces table. On the table there is an  
> output link
> that point to an action that returns a navigation view name. When I  
> click on
> it, it goes to that page as expected. In that page there is a button  
> to
> return to the previous page. I've pointed it to an action that  
> returns a
> navigation name to the previous page.
> The first problem I have is that when I click the button, it goes to  
> the
> previous page but it doesn't load properly some <link href> CSS  
> stylesheets
> I have in that page. I've set that links to relative addresses like
>
> <link href="../styles.css" rel="stylesheet" type="text/css"></link>  
> and are
> loaded perfectly the first time I go directly to it, but fails when  
> I click
> on the button on the other page. If I click refresh on the browser  
> the page
> is loaded correctly.
> Second is that when I click on the link button and go to the page,  
> if I
> click on the table to repeat the process, now the view it's not  
> redirected
> like before. It stays on the same page.
>
> Here is an extract of my faces-config.xml
>
>
> <navigation-rule>
> 		<from-view-id>/clients/show_clients.jsp</from-view-id>
> 		<navigation-case><from-outcome>update</from-outcome>
> 			
> 			<to-view-id>/clients/update_client.jsp</to-view-id>
> 		</navigation-case></navigation-rule>
> 	<navigation-rule>
> 		<from-view-id>/clients/update_client.jsp</from-view-id>
> 		<navigation-case>
> 			<from-outcome>added</from-outcome>
> 			<to-view-id>/clients/show_clients.jsp</to-view-id>
> 		</navigation-case>
> 		<navigation-case><from-outcome>return</from-outcome>
> 			
> 			<to-view-id>/clients/show_clients.jsp</to-view-id>
> 		</navigation-case></navigation-rule>
> 	
> show_clients.jsp is the first page with the table. When I click on  
> the table
> it goes to update_client.jsp.
> Then on update_client if I click on return it goes to show_client.jsp.
>
> I'm getting mad with this.
> Could anyone help me?
>
> Thanks a lot.
>
>
>
>
> -- 
> View this message in context: http://www.nabble.com/Problems-with-page-navigation-tp15717275p15717275.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>



Re: Problems with page navigation

Posted by dancantong <da...@hotmail.com>.

Thank you for your reply.
I've replaced the <link> tags in head section for <ice:outputStyle href=""
/> ones and now the CSS styles are loaded correctly.
I don't know why this happens because although you say that ICEFaces only
reloads the body content, I have the same CSS imports in every page so It
shouldn't matter that the head is not refreshed.

I've resolvend my second problem as you say. I have every view mapped with
.faces extension so I've set the navigation configuration like this:

	<navigation-rule>
		<from-view-id>/clients/show_clients.jsp</from-view-id>
		<navigation-case><from-outcome>update</from-outcome>
			
			<to-view-id>/clients/update_client.faces</to-view-id>
		</navigation-case>
		
	<navigation-rule>
		<from-view-id>/clients/show_clients.faces</from-view-id>
		<navigation-case><from-outcome>update</from-outcome>
			<to-view-id>/clients/update_client.faces</to-view-id>
		</navigation-case>
	</navigation-rule>	
			
The first navigation rule works when I first navigate from show_clients to
update_clients, and the second one when I return to show_clients and again
go to update_clients.

Thank you very much for your help.

-- 
View this message in context: http://www.nabble.com/Problems-with-page-navigation-tp15717275p15731617.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.