Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Shale Wiki" for change 
notification.

The following page has been changed by ReneZanner:
http://wiki.apache.org/shale/ViewControllerMapper

The comment on the change is:
added more information on purpose and providing a custom implementation

------------------------------------------------------------------------------
- === Default ===
+ == Purpose ==
  
-  * !DefaultViewControllerMapper 
[http://shale.apache.org/shale-core/apidocs/org/apache/shale/view/impl/DefaultViewControllerMapper.html
 Javadoc]
+ To support the !ViewController pattern Shale provides a mechanism for 
automatic 1:1 association of managed beans with JSF views. The 
[http://shale.apache.org/shale-core/apidocs/org/apache/shale/view/ViewControllerMapper.html
 ViewControllerMapper] interface provides the mapping between a given JSF view 
id and managed bean name in your faces-config.xml (maybe you've already seen 
those warnings "No !ViewController found for view id ..."). (For details on the 
!ViewController pattern look into the 
[http://shale.apache.org/shale-core/apidocs/org/apache/shale/view/ViewController.html
 Javadoc]!)
  
- === Custom ===
+ == Default Implementation ==
  
-  * http://www.mail-archive.com/user%40shale.apache.org/msg00158.html
+ The !DefaultViewControllerMapper maps view ids to managed bean names as 
documented in it's 
[http://shale.apache.org/shale-core/apidocs/org/apache/shale/view/impl/DefaultViewControllerMapper.html
 Javadoc].
  
+ '''ATTENTION:''' When your view ids have dots in it's name (e.g. 
"tiles.like.file.name.jsp"), the resulting managed bean name is illegal from 
JSF's point of view. The resulting managed bean name will be 
"tiles.like.file.name". It can be used without problems for defining the 
corresponding managed bean in your faces-config.xml. The problem is: it can 
never be used as a value binding expression.
+ The reason: JSFs default !VariableResolver interprets the first '.' in a 
value binding expression as separator between the scoped object (e.g. a managed 
bean) and the referenced property or method. So in this small example the 
!VariableResolver would look for a managed bean called "tiles" which is not 
defined - booom!
+ 
+ == Custom Implementation ==
+ 
+ To modify the mapping between view ids and managed bean names you can replace 
the !DefaultViewControllerMapper with an own implementation. As I stated in my 
message  [http://www.mail-archive.com/user%40shale.apache.org/msg00158.html 
here], you have to provide the following context parameter entry in your 
web.xml:{{{
+ <context-param>
+   <param-name>org.apache.shale.view.VIEW_CONTROLLER_MAPPER</param-name>
+   <param-value>foo.MyVerySpecialViewControllerMapper</param-value>
+ </context-param>}}}
+ 

Reply via email to