aspose file tools*
The moose likes Spring and the fly likes JSP filename confusion in Tiles? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "JSP filename confusion in Tiles?" Watch "JSP filename confusion in Tiles?" New topic
Author

JSP filename confusion in Tiles?

shai ban
Ranch Hand

Joined: Jan 05, 2010
Posts: 177
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

Joined: Feb 26, 2008
Posts: 166
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.

If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
shai ban
Ranch Hand

Joined: Jan 05, 2010
Posts: 177
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

Joined: Feb 26, 2008
Posts: 166
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.
 
wood burning stoves
 
subject: JSP filename confusion in Tiles?