spring mvc 之mvc:annotation-driven
来源:互联网 发布:手机锁机软件 编辑:程序博客网 时间:2024/05/16 13:40
@Controller
@RequestMapping("/Sys/Admin")
public class SysUserController {
@Autowired
private ISysUserSv sysUserSv;
@RequestMapping("/queryUserInfoById")
@ResponseBody
public ObjectqueryUserInfoById(HttpServletRequest request, HttpServletResponse response) {
String userId = request.getParameter("userId");
System.out.println(sysUserSv.querySysUserById(Long.parseLong(userId)).getCreateTime());
return sysUserSv.querySysUserById(Long.parseLong(userId));// "中文乱码";//
}
}
@RequestMapping("/Sys/Admin")
public class SysUserController {
@Autowired
private ISysUserSv sysUserSv;
@RequestMapping("/queryUserInfoById")
@ResponseBody
public ObjectqueryUserInfoById(HttpServletRequest request, HttpServletResponse response) {
String userId = request.getParameter("userId");
System.out.println(sysUserSv.querySysUserById(Long.parseLong(userId)).getCreateTime());
return sysUserSv.querySysUserById(Long.parseLong(userId));// "中文乱码";//
}
}
<mvc:annotation-driven >
<mvc:message-converters>
<!-- 转换date数据到String -->
<!-- <bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper">
<bean class="com.fasterxml.jackson.databind.ObjectMapper">
<property name="dateFormat">
<bean class="java.text.SimpleDateFormat">
<constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss" />
</bean>
</property>
</bean>
</property>
</bean>
<mvc:message-converters>
<!-- 转换date数据到String -->
<!-- <bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="objectMapper">
<bean class="com.fasterxml.jackson.databind.ObjectMapper">
<property name="dateFormat">
<bean class="java.text.SimpleDateFormat">
<constructor-arg type="java.lang.String" value="yyyy-MM-dd HH:mm:ss" />
</bean>
</property>
</bean>
</property>
</bean>
如方法返回Object,则时间将会正常显示为yyyy-MM-dd HH:mm:ss,如果将返回String类型,时间将显示为timestamp类型。
阅读全文
0 0
- spring mvc 之mvc:annotation-driven
- Spring MVC之<mvc:annotation-driven/>
- Spring mvc:annotation-driven
- spring ApplicationContext-mvc之<mvc:annotation-driven />初探
- Spring参考手册 mvc:annotation-driven
- 【Spring MVC】<mvc:annotation-driven/>详解
- Spring MVC 中关于 mvc:annotation-driven
- SpringMVC之mvc:annotation-driven
- 解析spring MVC3 <mvc:annotation-driven> 实现
- Spring: <mvc:annotation-driven />注解意义
- Spring中<mvc:annotation-driven />的作用
- spring <mvc:annotation-driven />注解意义
- <mvc:annotation-driven />
- <mvc:annotation-driven />
- <mvc:annotation-driven />
- <mvc:annotation-driven />意义
- <mvc:annotation-driven/>
- <mvc:annotation-driven/>
- python_MySQL之间的增删改查
- Android实现APP欢迎页面
- L2-006. 树的遍历
- JDBC
- Sudoku
- spring mvc 之mvc:annotation-driven
- 3339: Rmq Problem/3585: mex
- 关于JQuery的post回调函数不执行问题
- switch语句
- LintCode508
- HDU 5540 Secrete Master Plan
- spring框架对 remoting 支持的总结
- 六、基础教程-标题(Title)
- 苦橙花---不喧哗,自有声