Tuesday, 15 June 2010

jsp - Apache Tiles in Spring mvc project -


I am absolutely new to Tiles and novice at Basant MVC. I want to add tiles view to my current configuration. Please help

So far I have done this but it is not working:

  @EnableWebMvc @ Configuration @ ComponentScan ({"com.kharoud"}) Public class MvcConfiguraion Expands WebMvcConfigurerAdapter {Personal Performance Monitor Interceptor Display Interactor; @ Override public empty configured default serving handling (default servicer handler configurator conferencer) {configurer.enable (); } @ Override Public Blank Conference Content Annotation (Content Navigational Configuration Conferencer) {configurer.favorPathExtension (true); Configurer.useJaf (wrong); Configurer.ignoreAcceptHeader (wrong); Configure.mediaType ("html", media type. TEXT_HTML); Configure.mediaType ("json", media type. APIICATION_JSON); Configurer.defaultContentType (MediaType.TEXT_HTML); }; Public Zero addInteceptors (Interceptor Registry Registry) {registory.addInterceptor (performanceInteceptor); // registory.add Interactive (Change Locale Interceptor ()); } @bean (name = "messsource") public reloadable resourcebendmemsource reloadable resources bondsource () {reloadable resourcesBandlemJessource messagesSource = new reloadable rhesusbandsmessage source (); MessageSource.setBasenames ("classpath: message_eng"); MessageSource.setDefaultEncoding ("UTF-8"); Return messages source; } @ Bean Public View Resolver Content Conversation Vydorolver (Content Navigation Manager Manager) {List & lt; ViewResolver & gt; Reserves = New Arrestist & lt; ViewResolver & gt; (); InternalResourceViewResolver r1 = New InternalResourceViewResolver (); R1.setPrefix ("/ web-INF / views /"); R1.setSuffix ("jsp."); R1.setViewClass (JstlView.class); Resolvers.add (r1); JsonViewResolver r2 = new JsonViewResolver (); Resolvers.add (r2); Tiles Visual Roller R3 = View New Tile Rolver (); Resolvers.add (R3); ContentNegotiatingViewResolver Resolver = New ContentNotivingWeaverSolar (); Resolver.setViewResolvers (resolver); Resolver.setContentNegotiationManager (manager); Return resolver; } @bean public tile configurable tile configurator () {string [] definitions = new string [] {"web-INF / tiles / tiles.exml"}; Tiles Configure Tile Configure = New Tile Configurator (); TilesConfigurer.setDefinitions (Definitions); Return tile configurator; }}  

My Tiles.xml Just Basic Settings

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt ;! DOCTYPE Tile-Definitions Public "- // Apache Software Foundation // DTI Tile Configuration 3.0 / N" "http://tiles.apache.org/dtds/tiles-config_3_0.dtd"> & Lt; Tiles-Definitions & gt; & Lt; Definition name = "myapp.homepage" template = "/ layout.jsp" & gt; & Lt; Put-attribute name = "title" value = "Tiles Tutorial Homepage" /> & Lt; Put-attribute name = "header" value = "/ header.jsp" /> & Lt; Put-attribute name = "menu" value = "" /> & Lt; Put-attribute name = "body" value = "" / & gt; & Lt; Put-attribute name = "footer" value = "" /> & Lt; / Definition & gt; & Lt; / Tile-definitions & gt;  

layout.jp copy paste tile ORG

  & lt;% @ taglib uri = "http://tiles.apache.org/tags-tiles "Prefix =" tiles "%> & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; & Lt; Tiles: getAsString name = "title" /> & Lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td colspan = "2" & gt; & Lt; Tiles: insertAttribute name = "header" /> & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Tiles: insertAttribute name = "menu" /> & Lt; / TD & gt; & Lt; TD & gt; & Lt; Tiles: insertAttribute name = "body" /> & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td colspan = "2" & gt; & Lt; Tiles: insertAttribute name = "footer" /> & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

You need to configure tile / plug in the listener.

View

and


No comments:

Post a Comment