Announcement Announcement Module
Collapse
No announcement yet.
Tiles 2: How can I detect the root's View name in Controller code Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tiles 2: How can I detect the root's View name in Controller code

    So my app has the index.htm page and a couple of tiles (left & right content). I have created the tile definition like following:
    Code:
    <tiles-definitions>
    	<definition name=".root" template="/WEB-INF/templates/main.jsp">
    		<put-attribute name="content" value="/WEB-INF/templates/blank.jsp" />			
    		<put-attribute name="lbar" value="/WEB-INF/templates/blank.jsp" />
    		<put-attribute name="rbar" value="/WEB-INF/templates/blank.jsp" />
    	</definition>
    	
    	<definition name=".index" extends=".root">
    		<put-attribute name="content" value="/WEB-INF/jsp/index.jsp" />
    		<put-attribute name="lbar" value="/contentLeft.tile" />
    		<put-attribute name="rbar" value="/contentRight.tile" />
    	</definition> 
    </tiles-definitions>
    and described views attributes
    view.properties

    Code:
    index.(class)=org.springframework.web.servlet.view.tiles2.TilesView
    index.url=.index
    
    contentLeft.(class)=org.springframework.web.servlet.view.JstlView
    contentLeft.url=/WEB-INF/jsp/lbar.jsp
    all is working just fine but there is still one thing that I am not able to resolve...
    How can I get the original view name requested or the page name from Controller's code to decide on which page my contentLeft will be placed ?
    Because in ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) of the assigned controller for contentLeft tile the method request.getRequestURI() always returns the name of the root template in my case this WEB-INF/templates/main.jsp but originally was requested index.htm

    Many thanks for all for any help
Working...
X