Announcement Announcement Module
Collapse
No announcement yet.
Two templateResolvers. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Two templateResolvers.

    I must have two "templateResolver" beans. Each bean should have different source path. The first one is responsible for files from db and the second for render the view from html. I have two custom ServletContextTemplateResolver class. Controller should choose which one will be the first. The mapping request value is responsible for it. Here is my example code:
    Code:
    <beans:bean id="templateResolver1"
        class="org.....ServletContextTemplateResolver1">
        <beans:property name="prefix" value="/web-inf/views/" />
        <beans:property name="suffix" value=".html" />
        <beans:property name="templateMode" value="HTML5" />
    </beans:bean>
    
    <beans:bean id="templateResolver2"
        class="org......ServletContextTemplateResolver2">
        <beans:property name="prefix" value="/web-inf/datas/" />
        <beans:property name="suffix" value=".*" />
        </beans:bean>
    and controller:
    Code:
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public String showCartdetails(@PathVariable(value = "id") String id, Model model){
    //method to chose template resolver depends id value
                return id;
    }
    How does it resolve? Thanks
Working...
X