Goldfish
Goldfish

Reputation: 654

split configurations in spring - is it possible?

I would like to use different controllers in spring with different application configurations. For example lets say I have one configuration using jsf/primefaces and another one using thymeleaf (for no special reason). Is it possible to map these configurations independently to different controllers?

Upvotes: 2

Views: 45

Answers (1)

Vikram Saini
Vikram Saini

Reputation: 2771

Not sure but may be You can do it in two ways buy either returning view in your controller method as

@RequestMapping("/view1")
public String thymleaf(){
    return "thymleaf.html";
}

@RequestMapping("/view2")
public String jspView(){
    return "jspView.html";
}

or by configuring it in xml

<bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
     <property name="prefix" value="/WEB-INF/views/" />
     <property name="suffix" value=".html" />
     <property name="viewNames" value="thymeleaf/*" />
     <property name="templateMode" value="HTML5" />
</bean>

<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
     <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
     <property name="prefix" value="/WEB-INF/views/" />
     <property name="viewNames" value="jsp/*" />
     <property name="suffix" value=".jsp" />
</bean>

Upvotes: 1

Related Questions