springmvc
<!-- jsp --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> <property name="viewNames" value="*"/> <!-- 模板优先级别 --> <property name="order" value="1"></property> </bean> <!-- html --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/html/" /> <property name="suffix" value=".html" /> <property name="viewNames" value="html*"/> <!-- 模板优先级别 --> <property name="order" value="0"></property> </bean>
controller
@Controller @Scope("prototype") @RequestMapping("/viewResolver") public class ViewResolverController { @RequestMapping("/t1") public String t1() { return "index";// webinfo/jsp/index } @RequestMapping("/t2") public String t2() { return "htmlindex";// webinfo/html/index } }