• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JSP filename confusion in Tiles?

 
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.
 
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.
 
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic