cancel
Showing results for 
Search instead for 
Did you mean: 

How do I config separate JSP(JSF) pages for different types?

stk137
Champ in-the-making
Champ in-the-making
I I am trying to create my own pages for my own custom space types similar to how forums work.
To get started I copied browse.jsp to community-home.jsp and I added this to web-client-config-custom.xml

  <config evaluator="node-type" condition="my:community">
    <navigation>
      <override from-view-id="/jsp/browse/browse.jsp" to-view-id="/extension/jsp/community/community-home.jsp" />
      <override from-outcome="browse" to-view-id="/extension/jsp/community/community-home.jsp" />
    </navigation>
  </config>

Which is like what I saw for forums, but I must be missing something, it doesn't work right.  Clicking on a node of type my:community does take me to community-home.jsp, but then there's no escape.  Clicking on any links to other types of nodes (cm:folder) keeps me going to community-home.jsp, clicking on my dashboard doesn't work at all.  Although if I click on a forum node it does finally take me away from community-home.jsp and to a forum page.

What am I missing?  The forums work and I don't see any more config than I have setup for my type/page.
Are there any examples that discuss doing stuff like this?  I haven't found anything on the wiki yet.
5 REPLIES 5

gavinc
Champ in-the-making
Champ in-the-making
I'm not sure what is happening here, could you possibly turn on debugging for the alfresco navigation handler and post the results?

To do this add the following line to log4j.properties:

log4j.logger.org.alfresco.web.app.AlfrescoNavigationHandler=debug

stk137
Champ in-the-making
Champ in-the-making
I'm not sure what is happening here, could you possibly turn on debugging for the alfresco navigation handler and post the results?

So this is from navigating from my community node type (subclass of cm:folder) to several  regular folders (cm:folder) then to a forums space and back to a community then to forums and then to folders.

it goes to the community-home.jsp for my community type like it should
then it stays on community-home.jsp for all the folders that should have gone to browse.jsp.  It correctly goes to forums.jsp for that node type and (later) from forums.jsp to browse.jsp properly.  It just won't ever go from community-home.jsp to browse.jsp.


15:25:04,801 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:25:04,801 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:25:04,802 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://my.domain.foo/model}community' in dispatch context
15:25:04,804 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found navigation config: org.alfresco.web.config.NavigationResult@16c72cc (result=/extension/jsp/community/community-home.jsp isOutcome=false)
15:25:04,804 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] New view id is the same as the current one so setting outcome to null
15:25:04,805 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'null' to original navigation handler
15:25:04,805 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:25:14,210 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:25:14,210 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:25:14,224 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:25:14,226 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:25:14,227 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
15:25:14,227 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:25:14,227 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=null)
15:25:14,227 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:25:14,227 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No dispatch context found
15:25:14,227 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'null' to original navigation handler
15:25:14,227 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:25:18,213 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:25:18,214 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:25:18,215 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:25:18,217 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:25:18,217 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
15:25:18,217 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:25:41,484 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:25:41,484 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:25:41,486 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:25:41,489 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:25:41,489 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
15:25:41,489 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:25:48,632 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:25:48,632 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:25:48,634 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:25:48,637 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:25:48,637 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
15:25:48,637 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:26:02,463 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:26:02,463 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:26:02,464 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:26:02,467 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:26:02,467 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
15:26:02,467 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:26:06,493 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:26:06,493 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:26:06,495 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/forum/1.0}forums' in dispatch context
15:26:06,497 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found navigation config: org.alfresco.web.config.NavigationResult@8479af (result=/jsp/forums/forums.jsp isOutcome=false)
15:26:06,497 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Dispatching to new view id: /jsp/forums/forums.jsp
15:26:06,497 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:26:16,344 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:26:16,344 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/forums/forums.jsp
15:26:16,347 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:26:16,358 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:26:16,358 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
15:26:16,359 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:26:22,310 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=null)
15:26:22,310 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/browse/browse.jsp
15:26:22,311 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:26:22,314 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:26:22,314 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'null' to original navigation handler
15:26:22,314 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:26:36,757 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=null)
15:26:36,757 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/browse/browse.jsp
15:26:36,759 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://my.domain.foo/model}community' in dispatch context
15:26:36,761 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found navigation config: org.alfresco.web.config.NavigationResult@1a06d6 (result=/extension/jsp/community/community-home.jsp isOutcome=false)
15:26:36,761 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Dispatching to new view id: /extension/jsp/community/community-home.jsp
15:26:36,761 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []

15:34:40,839 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:34:40,839 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:34:40,841 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/forum/1.0}forums' in dispatch context
15:34:40,843 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found navigation config: org.alfresco.web.config.NavigationResult@8479af (result=/jsp/forums/forums.jsp isOutcome=false)
15:34:40,844 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Dispatching to new view id: /jsp/forums/forums.jsp
15:34:40,844 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:34:43,504 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=browse)
15:34:43,504 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/forums/forums.jsp
15:34:43,506 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:34:43,507 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:34:43,508 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'browse' to original navigation handler
15:34:43,508 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []
15:35:54,046 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=null)
15:35:54,046 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /jsp/browse/browse.jsp
15:35:54,048 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://www.alfresco.org/model/content/1.0}folder' in dispatch context
15:35:54,051 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No navigation configuration found for node
15:35:54,051 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'null' to original navigation handler
15:35:54,051 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: []

stk137
Champ in-the-making
Champ in-the-making
here's another clue for you all
I can't navigate from community-home.jsp to space-details.jsp for my community type either.

15:46:34,815 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] handleNavigation (fromAction=null, outcome=dialog:showSpaceDetails)
15:46:34,815 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Current view id: /extension/jsp/community/community-home.jsp
15:46:34,815 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Opening dialog 'showSpaceDetails'
15:46:34,815 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using dialog container: /jsp/dialog/container.jsp
15:46:34,815 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using wizard container: /jsp/wizard/container.jsp
15:46:34,815 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] current view is already top of the view stack!
15:46:34,816 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Using dispatch context for dialog lookup: {http://my.usgs.gov/model}community
15:46:34,818 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Found node with type '{http://my.usgs.gov/model}community' in dispatch context
15:46:34,818 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] No override configuration found for current view or outcome
15:46:34,818 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] Passing outcome 'showSpaceDetails' to original navigation handler
15:46:34,819 DEBUG [org.alfresco.web.app.AlfrescoNavigationHandler] view stack: [/extension/jsp/community/community-home.jsp]

gavinc
Champ in-the-making
Champ in-the-making
OK, I can see what is happening….

The navigation rules defined in faces-config-navigation.xml all presume that /jsp is at the start of the path. We normally recommend creating the extension folder under the jsp folder for this reason i.e. /jsp/extension.

You have /extension/jsp/… as your path, this means that none of the navigation rules are getting picked up and you remain on the current page (your custom one).

You therefore have 2 choices, you can either move your custom files to /jsp/extension (the easiest) or you'll have to duplicate all the navigation rules in faces-config-navigation.xml to be of the form:

<navigation-rule>
      <from-view-id>extension/jsp/*</from-view-id>
      <navigation-case>
         <from-outcome>browse</from-outcome>
         <to-view-id>/jsp/browse/browse.jsp</to-view-id>
      </navigation-case>
      ….
</navigation-rule>

This is obviously more work and likely to be more error prone so I'd go for  the first option!

stk137
Champ in-the-making
Champ in-the-making
thanks for helping me see my stupidity!
Your response is kinder and more informative than I deserve!

And I thought I was being clever putting all my stuff under /extension, intead of JSP here, images there, sitemesh decorators elsewhere.

thanks!

OK, I can see what is happening….

The navigation rules defined in faces-config-navigation.xml all presume that /jsp is at the start of the path. We normally recommend creating the extension folder under the jsp folder for this reason i.e. /jsp/extension.

You have /extension/jsp/… as your path, this means that none of the navigation rules are getting picked up and you remain on the current page (your custom one).

You therefore have 2 choices, you can either move your custom files to /jsp/extension (the easiest) or you'll have to duplicate all the navigation rules in faces-config-navigation.xml to be of the form:

<navigation-rule>
      <from-view-id>extension/jsp/*</from-view-id>
      <navigation-case>
         <from-outcome>browse</from-outcome>
         <to-view-id>/jsp/browse/browse.jsp</to-view-id>
      </navigation-case>
      ….
</navigation-rule>

This is obviously more work and likely to be more error prone so I'd go for  the first option!