使用Spring表单标签, 表单验证使用 JSR303 的验证注解,hibernate-validators,提供了使用MessageSource和访问静态资源(如CSS,JavaScript,图片)国际化支持我们的视图,使用ResourceHandlerRegistry,全部采用基于注解的配置。

请注意,JSR303是一种规范,hibernate-validator是我们在这篇文章中使用的一种实现,它也提供了几个不包含在规范中自己的验证注释。

  

插件:

validation-api 1.1.0.Final
hibernate-validator 5.1.2.Final

  

更新pom.xml,包括所需的依赖关系

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gugua4</groupId>
<artifactId>gugau6</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>gugau6 Maven Webapp</name>
<url>http://maven.apache.org</url> <properties>
<springVersion>4.3.5.RELEASE</springVersion>
<hibernate.validator>5.1.2.Final</hibernate.validator> <!-- hibernate.validator -->
<javax.validation>1.1.0.Final</javax.validation> <!-- JSR303 的验证注解 -->
<mysqlVersion>5.0.11</mysqlVersion>
<commonsDbcpVersion>1.4</commonsDbcpVersion>
<aspectjweaverVersion>1.8.13</aspectjweaverVersion>
<commonsLoggingVersion>1.2</commonsLoggingVersion>
</properties> <dependencies> <!-- spring-test支持 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency> <!-- spring模块库 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${springVersion}</version>
</dependency> <!-- (aop)@Aspect注解及代理 -->
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.6.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/cglib/cglib-nodep -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
</dependency> <!-- 依赖的持久化类库 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.0.5.RELEASE</version>
</dependency> <!-- io流/上传类插件 -->
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
</dependency> <!-- 连接池 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commonsDbcpVersion}</version>
</dependency> <!-- 公共基础类(字符处理,数组,日期,范围) -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency> <!-- jsp依赖的web模块库 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency> <!-- servlet(HttpServletRequest,HttpServletResponse) -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<!--
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
-->
</dependency> <!-- jsr303 validation dependencies/ JSR303 的验证注解-->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${javax.validation}</version>
</dependency>
<!-- hibernate validation 数据验证-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate.validator}</version>
</dependency> </dependencies> <build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<!-- jsp目录/项目访问目录 -->
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<!-- 项目名 -->
<warName>gugau6</warName>
<!-- 取消web.xml配置 -->
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<finalName>gugau6</finalName>
</build> </project>

  

首先要注意这里是 maven-war-plugin 插件声明。由于我们使用的是全注解配置,我们甚至不包括在 web.xml 中,所以我们需要配置这个插件,以避免Maven构建war包失败。在验证部分 validation-api 代表规范, 而hibernate-validator是本规范的一个实现。hibernate-validator还提供了一些它自己的注解(@Email,@NotEmpty等)不属于规范的一部分。

创建POJO/域对象

Student学生信息类

package springmvc.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size; import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Email; import org.springframework.format.annotation.DateTimeFormat; public class Student implements Serializable { @Size(min=3, max=30)
private String firstName; @Size(min=3, max=30)
private String lastName; @NotEmpty
private String sex; @DateTimeFormat(pattern="yyyy-MM-dd")
@Past @NotNull
private Date dob; @Email @NotEmpty
private String email; @NotEmpty
private String section; @NotEmpty
private String country; private boolean firstAttempt; @NotEmpty
private List<String> subjects = new ArrayList<String>(); public String getFirstName() {
return firstName;
} public void setFirstName(String firstName) {
this.firstName = firstName;
} public String getLastName() {
return lastName;
} public void setLastName(String lastName) {
this.lastName = lastName;
} public String getSex() {
return sex;
} public void setSex(String sex) {
this.sex = sex;
} public Date getDob() {
return dob;
} public void setDob(Date dob) {
this.dob = dob;
} public String getEmail() {
return email;
} public void setEmail(String email) {
this.email = email;
} public String getSection() {
return section;
} public void setSection(String section) {
this.section = section;
} public String getCountry() {
return country;
} public void setCountry(String country) {
this.country = country;
} public boolean isFirstAttempt() {
return firstAttempt;
} public void setFirstAttempt(boolean firstAttempt) {
this.firstAttempt = firstAttempt;
} public List<String> getSubjects() {
return subjects;
} public void setSubjects(List<String> subjects) {
this.subjects = subjects;
} @Override
public String toString() {
return "Student [firstName=" + firstName + ", lastName=" + lastName + ", sex=" + sex + ", dob=" + dob
+ ", email=" + email + ", section=" + section + ", country=" + country + ", firstAttempt=" + firstAttempt
+ ", subjects=" + subjects + "]";
} }

  

添加控制器

package springmvc.controller;

import java.util.ArrayList;
import java.util.List; import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import springmvc.model.Student; import org.springframework.web.bind.annotation.ModelAttribute; @Controller
@RequestMapping(value="/")
public class HelloWorldController { @RequestMapping(method=RequestMethod.GET)
public String newRegistration(ModelMap model)
{
Student student = new Student();
model.addAttribute("student", student);
return "hello_index";
} @RequestMapping(method=RequestMethod.POST)
public String saveRegistration(@Valid Student student, BindingResult result, ModelMap model)
{
if(result.hasErrors())
{
//System.out.println(student.toString()); //model.addAttribute("success", "Dear "+ student.getFirstName() + ", your Registration completed fail!");
//return "hello_result";
return "hello_index";
}
model.addAttribute("success", "Dear "+ student.getFirstName() + ", your Registration completed successfully!");
return "hello_result"; } @ModelAttribute("sections")
public List<String> initializeSections()
{
List<String> sections = new ArrayList<String>();
sections.add("graduate");
sections.add("post graduate");
sections.add("research");
return sections;
} @ModelAttribute("countries")
public List<String> initializeCountries()
{
List<String> countries = new ArrayList<String>();
countries.add("china");
countries.add("usa");
countries.add("germany");
return countries;
} @ModelAttribute("subjects")
public List<String> initializeSubjects()
{
List<String> subjects = new ArrayList<String>();
subjects.add("Physics");
subjects.add("Chemistry");
subjects.add("Life Science");
return subjects;
} }

  

@Valid要求spring来验证相关的对象(学生)。 BindingResult包含此验证,并可能在此验证过程中发生(产生)任何错误的结果。请注意,BindingResult一定要在之后立即生效对象,否则spring将无法验证并且将一个异常抛出。

添加配置类

package springmvc.configuration;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource; import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView; @Configuration
@EnableWebMvc
@ComponentScan(basePackages="springmvc")
public class HelloWorldConfiguration extends WebMvcConfigurerAdapter { @Bean
public ViewResolver viewResolver()
{
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setViewClass(JstlView.class);
viewResolver.setPrefix("/WEB-INF/views/");
viewResolver.setSuffix(".jsp");
return viewResolver;
} @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// TODO Auto-generated method stub
//super.addResourceHandlers(registry);
//复写静态资源
registry.addResourceHandler("/static/**").addResourceLocations("/static/");
} public MessageSource messageSource()
{
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("messages");
return messageSource;
} }

  

@Configuration指示该类包含注解为@Bean生产Bean管理是由Spring容器的一个或多个 bean 的方法。@EnableWebMvc 等效于 mvc:annotation-driven 在XML文件中。它能够为使用@RequestMapping 向特定的方法传入的请求映射@Controller-annotated类。 @ComponentScan 等效于  context:component-scan base-package="..." 提供具有到哪里查找管理Spring beans/类。

方法 ViewResolver 配置一个 ViewResolver 用来找出真正的视图。方法 addResourceHandlers 配置 ResourceHandler 静态资源。CSS, JavaScript, images 等都是静态的资源在你的页面里。上面的配置表示,所有的资源请求开始/static/,将从webapps文件夹下提供/static/。在这个例子中,我们把所有的css文件放在 Web应用程序的 /static/css 目录中。注意,此方法在 WebMvcConfigurerAdapter 中定义,因此我们需要扩展这个类来注册我们的静态资源覆盖此方法。

方法为 messageSource 配置消息包,以支持[国际化]消息属性文件。请注意方法 baseName 提供的参数(消息)。Spring 将搜索应用程序类路径中一个名为messages.properties文件。让我们添加的文件:

src/main/resources/messages.properties

Size.student.firstName=First Name must be between {2} and {1} characters long
Size.student.lastName=Last Name must be between {2} and {1} characters long
NotEmpty.student.sex=Please specify your gender
NotNull.student.dob=Date of birth can not be blank
Past.student.dob=Date of birth must be in the past
Email.student.email=Please provide a valid Email address
NotEmpty.student.email=Email can not be blank
NotEmpty.student.country=Please select your country
NotEmpty.student.section=Please select your section
NotEmpty.student.subjects=Please select at least one subject
typeMismatch=Invalid format

  

请注意,上述消息按照特定的模式

{ValidationAnnotationClass}.{modelObject}.{fieldName}

  

此外,根据具体的注释(如@Size),也可以用传递参数给这些消息:{0},{1},..{i}

以XML格式上述结构将是
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> <context:component-scan base-package="com.yiibai.springmvc" />
<mvc:annotation-driven/> <mvc:resources mapping="/static/**" location="/static/" />
<mvc:default-servlet-handler /> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename">
<value>messages</value>
</property>
</bean> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean> </beans>

  

添加视图(简单的JSP页面)

<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>student enrollment</title>
<link href="<c:url value='/static/css/bootstrap.css' />" ref="stylesheet">
<link href="<c:url value='/static/css/custom.css' />" ref="stylesheet">
</head>
<body> <div class="form-container">
<h1>Enrollment Form</h1>
<form:form method="post" modelAttribute="student" class="form-horizontal">
<div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-label" for="firstName">First Name</label>
<div class="col-md-7">
<form:input type="text" path="firstName" id="firstName" class="form-control input-sm" />
<div class="has-error">
<form:errors path="firstName" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-label" for="lastName">last Name</label>
<div class="col-md-7">
<form:input type="text" path="lastName" id="lastName" class="form-control input-sm" />
<div class="has-error">
<form:errors path="lastName" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-label" for="sex">sex</label>
<div class="col-md-7">
<form:radiobutton path="sex" value="M" />Male
<form:radiobutton path="sex" value="F" />Female
<div class="has-error">
<form:errors path="sex" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-label" for="email">email</label>
<div class="col-md-7">
<form:input path="email" id="email" class="form-control input-sm"/>
<div class="has-error">
<form:errors path="email" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-label" for="dob">dob</label>
<div class="col-md-7">
<form:input path="dob" id="dob" class="form-control input-sm"/>
<div class="has-error">
<form:errors path="dob" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-label" for="section">section</label>
<div class="col-md-7">
<form:radiobuttons path="section" id="section" items="${sections}"/>
<div class="has-error">
<form:errors path="section" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-label" for="country">country</label>
<div class="col-md-7">
<form:select path="country" id="country" class="form-control input-sm">
<form:option value="">please select</form:option>
<form:options items="${countries}"/>
</form:select>
<div class="has-error">
<form:errors path="country" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-lable" for="firstAttempt">First Attempt ?</label>
<div class="col-md-1">
<form:checkbox path="firstAttempt" class="form-control input-sm"/>
<div class="has-error">
<form:errors path="firstAttempt" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-group col-md-12">
<label class="col-md-3 control-label" for="subjects">subject</label>
<div class="col-md-7">
<form:select path="subjects" items="${subjects}" multiple="true" class="form-control input-sm"/>
<div class="has-error">
<form:errors path="subjects" class="help-inline"/>
</div>
</div>
</div>
</div> <div class="row">
<div class="form-actions floatRight">
<input type="submit" value="Register" class="btn btn-primary btn-sm">
</div>
</div> </form:form>
</div> </body>
</html>

  

result.jsp

<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>reuslt</title>
<link href="<c:url value='/static/css/custom.css'/>" ref="stylesheet">
</head>
<body> <div class="success">
Confirmation message : ${success}
<br>
We have also sent you a confirmation mail to your email address : ${student.email}.
</div> </body>
</html>

  

添加初始化器类

package springmvc.configuration;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

public class HelloWorldInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

	@Override
protected Class<?>[] getRootConfigClasses() {
// TODO Auto-generated method stub
return new Class[] { HelloWorldConfiguration.class };
} @Override
protected Class<?>[] getServletConfigClasses() {
// TODO Auto-generated method stub
return null;
} @Override
protected String[] getServletMappings() {
// TODO Auto-generated method stub
return new String[] { "/"};
} }

  

有一点要记住,如:WebApplicationInitializer,Spring 基于Java 配置API是依赖Servlet3.0容器的。所以一定要确保你没有使用 Servlet 声明任何在 web.xml 小于3.0。对于我们的情况,我们要从应用程序中删除 web.xml 文件。

spring mvc:练习:表单验证(javaConfig配置和注解)的更多相关文章

  1. Spring MVC与表单日期提交的问题

    Spring MVC与表单日期提交的问题 spring mvc 本身并不提供日期类型的解析器,需要手工绑定, 否则会出现非法参数异常. org.springframework.beans.BeanIn ...

  2. spring mvc form表单提交乱码

    spring mvc form表单submit直接提交出现乱码.导致乱码一般是服务器端和页面之间编码不一致造成的.根据这一思路可以依次可以有以下方案. 1.jsp页面设置编码 <%@ page ...

  3. spring+thymeleaf实现表单验证数据双向绑定

    前言 这个教程介绍了Thymeleaf与Spring框架的集成,特别是SpringMvc框架. 注意Thymeleaf支持同Spring框架的3.和4.版本的集成,但是这两个版本的支持是封装在thym ...

  4. ASP.NET MVC Form表单验证与Authorize特性

    一.Form表单验证 1.基本概念 表单验证是一个基于票据(ticket-based)[也称为基于令牌(token-based)]的系统.当用户登录系统以后,会得到一个包含基于用户信息的票据(tick ...

  5. Spring Boot学习——表单验证

    我觉得表单验证主要是用来防范小白搞乱网站和一些低级的黑客技术.Spring Boot可以使用注解 @Valid 进行表单验证.下面是一个例子. 例子说明:数据库增加一条Student记录,要求学生年龄 ...

  6. spring:设置映射访问路径 或 xml配置访问路径 (spring mvc form表单)

    项目hello, 在src/main/java下面建一个目录: charpter2 一.xml配置访问路径 web.xml <web-app> <display-name>Ar ...

  7. Spring MVC 3 表单中文提交post请求和get请求乱码问题的解决方法

    在spring mvc 3.0 框架中,通过JSP页面.HTML页面以POST方式提交表单时,表单的参数传递到对应的servlet后会出现中文显示乱码的问题.解决办法可采用spring自带的过滤技术, ...

  8. spring mvc 接收表单 bean

    spring MVC如何接收表单bean 呢? 之前项目中MVC框架一直用struts2,所以我也就按照struts2 的思维来思考 页面loginInput.jsp: <?xml versio ...

  9. spring mvc 提交表单的例子

    1. 构建MAVEN项目,然后转换成web格式,结构图如下: 2. 通过@RequestMapping来进行配置,当输入URL时,会以此找到对应方法执行,首先调用setupForm方法,该方法主要是生 ...

随机推荐

  1. 简明python教程九----异常

    使用try...except语句来处理异常.我们把通常的语句放在try-块中,而把错误处理语句放在except-块中. import sys try: s = raw_input('Enter som ...

  2. PAT 1036 Boys vs Girls[简单]

    1036 Boys vs Girls (25 分) This time you are asked to tell the difference between the lowest grade of ...

  3. spoj1812 LCS2 - Longest Common Substring II

    地址:http://www.spoj.com/problems/LCS2/ 题面: LCS2 - Longest Common Substring II no tags  A string is fi ...

  4. GYM - 101490 J Programming Tutors (匈牙利+二分)

    题意:有N个学生和N个老师,每个人都有自己的坐标X,Y,给每个学生匹配一个老师,要求N个匹配中的距离最大值最小.其中距离的定义为:|X − X’| + |Y − Y ‘|. 分析:一道典型的最大值最小 ...

  5. MVC[xml]页面传值

    MVC 各种传值方式 ViewData传值.HomeController.cs Co de: public ActionResult Index(){      ViewData["Titl ...

  6. cocos2d-x 2.x.x 新建工程 android下的 org文件夹丢失

    cocos2d-x 2.x.x 新建工程之后... 打开android项目..会发现src下没有org文件... 解决方法一: cocos2d-x-2.2.0\cocos2dx\platform\an ...

  7. Spring MVC 流程

    1. 检查是否为上传文件. 2. 通过HandlerMapping获取HandlerExecutionChain: DispatcherServlet 中包含:handlerMappings , 遍历 ...

  8. xlrd的使用操作

    # _*_ coding:utf-8 _*_ #---------------------------------------------------------------------------- ...

  9. PHP开发之环境配置

    nignx //start nginx -s reload //restart composer create-project laravel/laravel learnlaravel5 //自动创建 ...

  10. 老话题之C#写邮件发送

    唉!近来特么QQ邮件也犯二,突然间以前写的代码邮件发不出去,各种报错,无奈之下,换成了@163.com,可是报错依然,该开通(POP3/SMTP/IMAP)的都开通了!我勒了个草,像是在玩哥一样,还好 ...