实训中~~
来源:互联网 发布:挂机赚钱软件 编辑:程序博客网 时间:2024/06/06 16:32
理解Object...:
Object...objects这种参数定义是在不确定方法参数的情况下的一种多态表现形式。即这个方法可以传递多个参数,这个参数的个数是不确定的。这样你在方法体中需要相应的做些处理。因为Object是基类,所以使用Object.
ajax:异步请求
$.post("test.php",{name:"john",time:"2017.9.11"},);
向页面 test.php 发送数据,并输出结果(HTML 或 XML,取决于所返回的内容):
$.post("test.php", { name: "John", time: "2pm" },
function(data){
alert("Data Loaded: " + data);
});
web.xml里面配置:
<init-param>
<param-name></param-name>
<param-value></param-value>
</init-param>
获取:
ServletConfig config=this.getServletConfig();
String sheng=config.getInitParameter("sheng");
System.out.println(sheng);
HttpServletRequest 一次请求
HttpSession 一次对话
Applictaion 整个服务器有效
ServletContext application=this.getServletContext();//application 初始化
String realPath = application.getRealPath("/aa");//获取真实物理路径
Set<String> set = application.getResourcePaths(path);//获取指定文件夹下的所有文件
foreach: items var varStaus(index,count)
<c:choose>
<c:when test="${index.count==1}">
<a href="http://www.baidu.com"><img src="${img}" width="100px"
height="100px" /></a>
</c:when>
<c:when test="${index.count==11}">
<a href="http://www.xxxx"><img src="${img}" width="100px"
height="100px" /> </a>
</c:when>
<c:otherwise>
<img src="${img}" width="100px" height="100px" />
</c:otherwise>
</c:choose>
<c:if test="${index.count%5==0}">
<br />
</c:if>
</c:forEach>
filter 过滤器
init() 服务器启动时就被初始化
doFilter()
destroy()
Filter中的request,response和servlet中的reuqest和response不一样。一个是父类,一个是子类
HttpServletRequest request2 = (HttpServletRequest) request;
HttpServletResponse response2 = (HttpServletResponse) response;
request2.setCharacterEncoding(encode);
request2.setAttribute("filterParam", "test");
chain.doFilter(request2, response2);
filter在servlet前执行!
更改密码,提示: mysqladmin: Can't turn off logging; error: 'Access denied; you need the SUPER privilege for this operation'" :
解决方案:
1.修改MySQL的登录设置:
# vi /etc/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables
例如:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-name-resolve
skip-grant-tables
保存并且退出vi。
重新启动mysqld
# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
登录并修改MySQL的root密码
# /usr/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.56
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> USE mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> flush privileges ;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
2.将MySQL的登录设置修改回来
# vi /etc/my.cnf
将刚才在[mysqld]的段中加上的skip-grant-tables删除
保存并且退出vi。
3.重新启动mysqld
# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
centos 重启mysql mariadb版本:
service mariadb restart
Object...objects这种参数定义是在不确定方法参数的情况下的一种多态表现形式。即这个方法可以传递多个参数,这个参数的个数是不确定的。这样你在方法体中需要相应的做些处理。因为Object是基类,所以使用Object.
ajax:异步请求
$.post("test.php",{name:"john",time:"2017.9.11"},);
向页面 test.php 发送数据,并输出结果(HTML 或 XML,取决于所返回的内容):
$.post("test.php", { name: "John", time: "2pm" },
function(data){
alert("Data Loaded: " + data);
});
web.xml里面配置:
<init-param>
<param-name></param-name>
<param-value></param-value>
</init-param>
获取:
ServletConfig config=this.getServletConfig();
String sheng=config.getInitParameter("sheng");
System.out.println(sheng);
HttpServletRequest 一次请求
HttpSession 一次对话
Applictaion 整个服务器有效
ServletContext application=this.getServletContext();//application 初始化
String realPath = application.getRealPath("/aa");//获取真实物理路径
Set<String> set = application.getResourcePaths(path);//获取指定文件夹下的所有文件
foreach: items var varStaus(index,count)
<c:choose>
<c:when test="${index.count==1}">
<a href="http://www.baidu.com"><img src="${img}" width="100px"
height="100px" /></a>
</c:when>
<c:when test="${index.count==11}">
<a href="http://www.xxxx"><img src="${img}" width="100px"
height="100px" /> </a>
</c:when>
<c:otherwise>
<img src="${img}" width="100px" height="100px" />
</c:otherwise>
</c:choose>
<c:if test="${index.count%5==0}">
<br />
</c:if>
</c:forEach>
filter 过滤器
init() 服务器启动时就被初始化
doFilter()
destroy()
Filter中的request,response和servlet中的reuqest和response不一样。一个是父类,一个是子类
HttpServletRequest request2 = (HttpServletRequest) request;
HttpServletResponse response2 = (HttpServletResponse) response;
request2.setCharacterEncoding(encode);
request2.setAttribute("filterParam", "test");
chain.doFilter(request2, response2);
filter在servlet前执行!
更改密码,提示: mysqladmin: Can't turn off logging; error: 'Access denied; you need the SUPER privilege for this operation'" :
解决方案:
1.修改MySQL的登录设置:
# vi /etc/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables
例如:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-name-resolve
skip-grant-tables
保存并且退出vi。
重新启动mysqld
# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
登录并修改MySQL的root密码
# /usr/bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 3.23.56
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> USE mysql ;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 2 Changed: 0 Warnings: 0
mysql> flush privileges ;
Query OK, 0 rows affected (0.01 sec)
mysql> quit
Bye
2.将MySQL的登录设置修改回来
# vi /etc/my.cnf
将刚才在[mysqld]的段中加上的skip-grant-tables删除
保存并且退出vi。
3.重新启动mysqld
# /etc/init.d/mysqld restart
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]
centos 重启mysql mariadb版本:
service mariadb restart