SpringMVC+Spring+Mybatis实现最简单的登录验证(2)

<!--避免IE执行AJAX时,返回JSON出现下载文件 -->
<bean>
<property>
<list>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean>

<!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
<bean>
<property>
<list>
<ref bean="mappingJacksonHttpMessageConverter" /> <!-- JSON转换器 -->
</list>
</property>
</bean>

<!-- 定义跳转的文件的前后缀 ,视图模式配置 -->
<bean>
<!-- 这里的配置我的理解是自动给后面action的方法return的字符串加上前缀和后缀,变成一个 可用的url地址 -->
<property value="/WEB-INF/" />
<property value=".jsp" />
</bean>

<!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 -->
<bean>
<!-- 默认编码 -->
<property value="utf-8" />
<!-- 文件大小最大值 -->
<property value="10485760000" />
<!-- 内存中的最大值 -->
<property value="40960" />
</bean>
</beans>

Account.Java

SpringMVC+Spring+Mybatis实现最简单的登录验证

1 package com.cn.ft.entity; 2 3 public class Account { 4 private Integer id; 5 private String user; 6 private String paw; 7 private Integer age; 8 9 public Integer getId() { 10 return id; 11 } 12 13 public void setId(Integer id) { 14 this.id = id; 15 } 16 17 public String getUser() { 18 return user; 19 } 20 21 public void setUser(String user) { 22 this.user = user; 23 } 24 25 public String getPaw() { 26 return paw; 27 } 28 29 public void setPaw(String paw) { 30 this.paw = paw; 31 } 32 33 public Integer getAge() { 34 return age; 35 } 36 37 public void setAge(Integer age) { 38 this.age = age; 39 } 40 41 }

Account.java

 AccountDao.java

SpringMVC+Spring+Mybatis实现最简单的登录验证

1 package com.cn.ft.dao; 2 3 import com.cn.ft.entity.Account; 4 5 public interface AccountDao { 6 public Account getByName(String user); 7 }

AccountDao.java

accountMapping.xml

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/14335.html