We need to change the default page for the DXA application to load the following URL

http://localhost:9081/ -----> http://localhost:9081/index.jsp

http://localhost:9081/admin/refresh -----> http://localhost:9081/index.jsp

The index.jsp is not a part of my web application. The pages are rendered from broker DB but my index.jsp is in the file system.

I tried the adding the reference in web.xml but it's not working,

enter image description here

also,

enter image description here

Also tried the configuration but not working,

@Configuration
    public class MyWebMvcConfig {

        @Bean
        public WebMvcConfigurerAdapter forwardToIndex() {

            System.out.println("My Homepage");
            return new WebMvcConfigurerAdapter() {
                @Override
                public void addViewControllers(ViewControllerRegistry registry) {                       
                    registry.addViewController("/").setViewName(
                            "forward:/index.jsp");
               }
            };
        }
    }

Where does DXA set the homepage for /admin/refresh and how can I customize that to render my index.jsp from the filesystem

DXA would render the page content directly from the database. The view models can be cached. For you to be able to render a file (instead of the model from the database) from the filesystem directly, you may need to write a custom HTTP handler for that.

If you only have an index page that is available in the filesystem, I would suggest publishing that from tridion and if that extension does not exist, create a new index PT. Is there a specific reason to have this file in the filesystem and NOT as a Tridion page?

Do note that having a custom handler for your requests will execute for all requests! You need to be smart in the filter criteria that you set for the handler.

  • Thanks Shiva! We are implementing a hybrid model which has the old jsp's published in the filesystem co existing with the new html file in broker DB. – Sandeep Deshmukh Jun 14 '17 at 2:57
  • In that case, a handler serving response first from your filesystem and if it is unavailable, we should let DXA Static Context serve the content for you. This would mean filesystem first followed by Tridion DB. You should prob. have a setting to turn this off whenever your old jsps are migrated. – Shiva Jun 14 '17 at 17:26

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.