aspose file tools*
The moose likes Spring and the fly likes Tiles view and Json view independently Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Tiles view and Json view independently" Watch "Tiles view and Json view independently" New topic
Author

Tiles view and Json view independently

Ponnusamy Gov
Greenhorn

Joined: Feb 01, 2011
Posts: 17


Dear All,

I am using tiles view and json view for viewing purpose in spring framework 2.5.6. But in some application servers i am getting below error.
0000007b servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper service SRVE0068E: Uncaught exception created in one of the service methods of the servlet corporateuser in application corpuser_2404_war. Exception created : javax.servlet.ServletException: No Tiles definition found for name 'jsonView'
at org.springframework.web.servlet.view.tiles.TilesView.prepareForRendering(TilesView.java:104)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:212)


Code to specify the json view:


xml configuration for json view:



Any one have any idea why this tiles error is coming since two views are configured properly.

thanks,
Pons
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Simply because you are passing the "String" in the ModelAndView that the ViewResolver uses to resolve the view. It is most likely being resolved by the Tiles Configurer/View Resolver and not by the File one in your configuration. Basically all view resolvers will get the string your return, and the first one to say something wins, so in your case the Tiles one gets it first.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Sudhir Ravindra
Greenhorn

Joined: May 31, 2010
Posts: 16
Your controller has already done the work of writing the json into the response. You need to return null from the controller to ensure that spring mvc does not forward further to a view.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tiles view and Json view independently