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: [email protected]
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