veloctity
来源:互联网 发布:亿商网络 编辑:程序博客网 时间:2024/06/06 07:14
<context:component-scan base-package="org.ny.blog.controller"/>
<!-- 注解器适配器和注解器映射器 -->
<mvc:annotation-driven/>
<!-- 视图解析器 -->
<bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<property name="resourceLoaderPath" value="/WEB-INF/"/>
<property name="configLocation" value="/WEB-INF/velocity.properties"/>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
<property name="cache" value="true"/>
<property name="prefix" value=""/>
<property name="suffix" value=".vm"/>
</bean>
</beans>
在WBE-INF下创建veloctity.properties
内容如下input.encoding=UTF-8
output.encoding=UTF-8
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
@Controller
@RequestMapping("/user")
public class UserController {
@RequestMapping(value = "/getUser", method = RequestMethod.GET)
public ModelAndView getUser() {
ModelAndView mv = new ModelAndView();
mv.addObject("message", "Hello World!!!");
mv.setViewName("/hello");
return mv;
}
}
在view里面创建一个hello.jsp
${message}
- veloctity
- AngualrJs 最新 文件图片上传教程3:Client-Controller-curdtable
- CCF201503-2 数字排序
- SpringBoot重写addResourceHandlers解决resources下面静态资源无法访问
- [Windosw Erro 1114] 动态链接库(Dll)初始化例程失败
- 2017-09-14
- veloctity
- python 中文字符报错Process finished with exit code 0
- python 面向对象__call__
- Python基础01
- 201512-1数位之和
- android linux编译tensorflow的jar包和so文件
- 浅谈数据分析和数据建模
- 欢迎使用CSDN-markdown编辑器
- ArrayList与LinkedList的区别