. p o s t ( ) 和 .post()和 .post()和.get()是jQuery Ajax的第二次封装,由于 . A j a x ( ) 写法过于臃肿,简化为 .Ajax()写法过于臃肿,简化为 .Ajax()写法过于臃肿,简化为.post()和$.get(),功能是相同的没有区别。但是写法要求更高,顺序不能改变。
packagecom.lfg.servlet;importjavax.servlet.ServletException;importjavax.servlet.annotation.WebServlet;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importjava.io.IOException;importjava.io.PrintWriter;@WebServlet("/registerServlet")publicclassRegisterServletextendsHttpServlet{@OverrideprotectedvoiddoPost(HttpServletRequest req,HttpServletResponse resp)throwsServletException,IOException{String name = req.getParameter("name");boolean res =true;//账号不能是admin和chenweiif("admin".equals(name)||"lfg".equals(name)){
res =false;}PrintWriter out = resp.getWriter();
out.print(res);
out.close();}}
packagecom.lfg.dao;importcom.lfg.entity.Student;importjava.util.List;publicinterfaceStudentDao{List<Student>getStudentBySname(String sname);}packagecom.etime.dao.impl;importcom.etime.dao.StudentDao;importcom.etime.entity.Student;importcom.etime.util.C3P0Util;importorg.apache.commons.dbutils.QueryRunner;importorg.apache.commons.dbutils.handlers.BeanListHandler;importjava.sql.SQLException;importjava.util.List;publicclassStudentDaoImplimplementsStudentDao{QueryRunner queryRunner =newQueryRunner(C3P0Util.getDataSource());@OverridepublicList<Student>getStudentBySname(String sname){List<Student> list =null;String sql ="select * from student where sname like ?";try{
list = queryRunner.query(sql,newBeanListHandler<>(Student.class),"%"+sname+"%");}catch(SQLException e){
e.printStackTrace();}return list;}}
(6)实现效果
六.同异步
1.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
Title
2.servlet
packagecom.lfg.servlet;importjavax.servlet.ServletException;importjavax.servlet.annotation.WebServlet;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;importjava.io.IOException;importjava.io.PrintWriter;@WebServlet("/asyncServlet")publicclassAsyncServletextendsHttpServlet{@OverrideprotectedvoiddoGet(HttpServletRequest req,HttpServletResponse resp)throwsServletException,IOException{String flag = req.getParameter("flag");PrintWriter out = resp.getWriter();if("first".equals(flag)){
out.print("
// 多态, 在JAVA中是这样用的, 其实在PHP当中可以自然消除, 因为参数是动态的, 你传什么过来都可以, 不限制类型, 直接调用类的方法
abstract class Tiger {
public abstract function climb();
}
class XTiger extends Tiger {
public function climb()
jQuery.extend({
handleError: function( s, xhr, status, e ) {
// If a local callback was specified, fire it
if ( s.error ) {
s.error.call( s.context || s, xhr, status, e );
}
always 总是
rice 水稻,米饭
before 在...之前
live 生活,居住
usual 通常的
early 早的
begin 开始
month 月份
year 年
last 最后的
east 东方的
high 高的
far 远的
window 窗户
world 世界
than 比...更
最近使用mybatis.3.1.0时无意中碰到一个问题:
The errors below were detected when validating the file "mybatis-3-mapper.dtd" via the file "account-mapper.xml". In most cases these errors can be d