层次目录:

1、 MyViewResolverController.java
package com.czl.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class MyViewResolverController {
@RequestMapping("handleplus")
public String hanldeplus(Model model){
model.addAttribute("av1", "日韩无码");
model.addAttribute("av2","欧美精品");
return "meinv:/gaoqing";
}
}
2、自定义视图解析器,实现解析器接口还有优先级接口
MyMeiNvViewResolver:
package com.czl.view;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.ui.Model

本文详细介绍了如何在SpringMVC中创建并配置自定义视图解析器。通过实现`ViewResolver`接口及优先级接口,自定义了`MyMeiNvViewResolver`,并设计了一个简单的`MyView`接口实现类。同时,在配置文件中设置了自定义解析器的启动优先级,确保其最先运行。最后展示了使用该解析器的`index.jsp`页面。
最低0.47元/天 解锁文章
957





