Win a flower (🌹) or copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java (📚) this week in the Agile and Other Processes forum!
  • 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
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

JSP filename confusion in Tiles?

 
pioneer
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.
 
pioneer
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
pioneer
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
pioneer
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.
 
A tiny monkey bit me and I got tiny ads:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!