Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP filename confusion in Tiles?

 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to Spring. Tried a Tiles example. Having a query. Lets say, I am returning a logical name 'showTilePage' from the controller and I have two resolvers declared InternalResourceViewResolver or TilesViewResolver. How DispatcherServlet will know which resolver to consult for a particular logical view name? Is that logical view name is unique among all the controller's view names?
When I tried below example I returned logical view name 'showTilePage' and template jsp name was different. I thought it will pick the 'showTilePage' below definition and will render the parent template's jsp that was something different earlier. But to my utmost surprise, it was asking for showTilePage.jsp!!! So I had to change jsp name in the parent template definition? Does it means, template file name in parent template and 'name' in child tile definition should be same as below example?
Please let me know if I am not clear.

<tiles-definitions>

<!-- Default Main Template -->
<definition name=".mainTemplate" template="/WEB-INF/jsp/showTilePage.jsp">
<put-attribute name="title" value="Empty" type="string" cascade="true"/>
<put-attribute name="header" value="/WEB-INF/views/templates/header.jsp" />
<put-attribute name="footer" value="/WEB-INF/views/templates/footer.jsp" />
<put-attribute name="menu" value="/WEB-INF/views/templates/menu.jsp" />
<put-attribute name="body" value="/WEB-INF/views/templates/blank.jsp" />
</definition>

<definition name="showTilePage" extends=".mainTemplate">
<put-attribute name="title" value="Spring TILES example" type="string" cascade="true" />
<put-attribute name="body" value="/WEB-INF/views/jsp/body.jsp" />
</definition>

</tiles-definitions>

Thanks.
 
Jhakda Velu
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post how you have added view resolvers? If no order is specified, i think InternalViewResolver will be used. If you post more details, someone may be able to help.
 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jhakda Velu wrote:Can you post how you have added view resolvers? If no order is specified, i think InternalViewResolver will be used. If you post more details, someone may be able to help.


I didn't specify any order for both resolvers thats why it was giving the problem. After specifying, it solved.
Thanks.
 
Jhakda Velu
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to know that your issue is resolved

I used spring around 2 years back, back then it was Spring 2.x, and came to forum to find out how I would fare now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic