False alarm.  The problem is not with the faces switching to a different page, 
it seems the problem is using the t:commandNavigation2 component.  If I put a 
t:commandLink in the page that calls the same exact method as the 
t:commandNavigation2 all my page values are updated.  Maybe that is a 
deliberate design decision of the t:commandNavigation2 component or maybe it is 
a bug.  I will submit that to the faces list when I get a chance.  

Even though my specific problem is solved, I would still like to know the 
answer to my original Spring/Shale/Faces question.  I believe it may come in 
handy in the future to be able to use Spring AOP on the view controllers.


JB

-----Original Message-----
From: Baker,Jonathan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 10, 2006 9:51 AM
To: user@shale.apache.org
Subject: RE: Shale, Spring AOP and Faces-config

Well, I thought of that, but the problem is that we have a requirement to save 
off all of the state on the current page whenever the user navigates to another 
page and in my tests, even though the values on my page were being submitted (I 
checked using fiddler) Faces is not updating the main ViewController values 
when we are directing to a new page.  So I thought the way to handle that was 
trick faces into thinking that the navigation methods were actually a part of 
the current backing bean so its values could get saved. 


JB

-----Original Message-----
From: René Zanner [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 10, 2006 9:25 AM
To: user@shale.apache.org
Subject: Re: Shale, Spring AOP and Faces-config

Hi Jonathan,

since the navigation bar is visible on all pages, why don't you use a special 
backing bean (e.g. NavigationController) for your navigation bar and put all 
the global navigation code into action listener methods of that specific bean?
It can reside in session scope (or even in application scope if it doesn't have 
any state information like the currently displayed view or something like that).

Code belonging to global navigation shouldn't go into a ViewController 
responsible for managing a single view (not even in the base class).

So, in your JSP you reference two different managed beans, but hey - what's 
wrong with that? If you use any kind of view composition, you don't even have 
the references in the same files ;o)

(Very rudimentary) Example:
---------------------------

navigationBar.jsp:

...
<h:commandLink action="#{navigationController.gotoPage1}">Page 
1</h:commandLink> <h:commandLink 
action="#{navigationController.gotoPage2}">Page 2</h:commandLink> ...


page1.jsp:

...
<jsp:include page="navigationBar.jsp"/>
...
<%-- normal ViewController reference --%> <h:outputText value="[EMAIL 
PROTECTED]"/>
...


Cheers,

René


----- Original Message -----
From: Baker,Jonathan
[mailto:[EMAIL PROTECTED]
To: user@shale.apache.org
Sent: Thu, 10 Aug 2006
15:08:02 +0200
Subject: Shale, Spring AOP and Faces-config


> All of the pages in my application will have a navigation bar.  
> Instead of trying to have some superclass for all of my 
> ViewControllers that contains methods that can be called on the 
> navbar, I thought I would try something less invasive.  I wanted to 
> use Spring AOP introductions to stick the navbar methods into each 
> ViewController at runtime.
> 
> I seem to have come across some problems in attempting this though.  
> Issues:
> *     I need to define the view controller in the faces-config file
> because it needs some sessionscope variables injected into him at 
> runtime, because the view controller is in request scope.  I do not 
> know how to reference things from session scope in the spring 
> configuration file.  Also if I define my view controller in spring for 
> some reason faces cannot find it.
> *     I thought, ok I will define my advisor in faces config and also
> my ProxyFactoryBean in faces as well.  Unfortunately this doesn't work 
> either.  The spring applicationContext object turns list entries into 
> object arrays whereas the faces config turns list entries into 
> ArrayLists.  Things blow up when trying to set the interceptorNames 
> field in the ProxyFactoryBean with an ArrayList instead of a String[].
> *     I cheated in the debugger to get around the list/array issue,
> but when Spring resolves something that it knows is a factory it calls 
> the getObject method so that it actually returns your aspect decorated 
> target.  Faces is not smart enough to do that, so basically it is 
> returning the factorybean object instead of my viewController+nav that 
> I was hoping to get.
> 
> I hope I am missing something.  I guess what I need is a way for the 
> two config files to be interchangeable, meaning that the spring file 
> can have access to the faces beans and also to beans located in the 
> various scopes (session, request, etc.)  Is this possible?  Am I 
> making things too complicated?
> 
> 
> 
> JB
> 
> 
> 

Reply via email to