`
Junjiejkl
  • 浏览: 61852 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论
阅读更多
代码部分

request请求参数的获取+BeanUtils框架

package cn.itcast.web.request;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo1 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		/*
		 * http://localhost:8080/day07/Demo1?name=jack&password=123回车
		 */
		//StringBuffer sb = request.getRequestURL();
		//String s1 = request.getRequestURI();
		//String s2 = request.getQueryString();
		//System.out.println(sb);
		//System.out.println(s1);
		//System.out.println(s2);
		
		//String s1 = request.getPathInfo();
		//String s2 = request.getRemoteAddr();
		//String s3 = request.getRemoteHost();
		//int s4 = request.getRemotePort();//1158
		
		String s1 = request.getLocalAddr();
		String s2 = request.getLocalName();
		int s3 = request.getLocalPort();//8080
		
		System.out.println(s1);
		System.out.println(s2);
		System.out.println(s3);
		
		
		
	}
}
getRequestURL方法返回客户端发出请求时的完整URL。
getRequestURI方法返回请求行中的资源名部分。
getQueryString 方法返回请求行中的参数部分。
getPathInfo方法返回请求URL中的额外路径信息。额外路径信息是请求URL中的位于Servlet的路径之后和查询参数之前的内容,它以“/”开头。
getRemoteAddr方法返回发出请求的客户机的IP地址。
getRemoteHost方法返回发出请求的客户机的完整主机名。
getRemotePort方法返回客户机所使用的网络端口号。
getLocalAddr方法返回WEB服务器的IP地址。
getLocalName方法返回WEB服务器的主机名。

package cn.itcast.web.request;

import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo2 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		/*
		String host = request.getHeader("host");
		System.out.println("host=" + host);
		Enumeration enums = request.getHeaders("accept");
		while(enums.hasMoreElements()){
			String value = (String) enums.nextElement();
			System.out.print(value+"|");
		}
		*/
		Enumeration enums1 = request.getHeaderNames();
		while(enums1.hasMoreElements()){
			String key = (String) enums1.nextElement();//host|accept
			Enumeration enum2 = request.getHeaders(key);
		}
	}
}

package cn.itcast.web.request;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo3 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		
		/*
		String name = request.getParameter("name");
		String password = request.getParameter("password");
		String aihao = request.getParameter("aihao");
		String[] aihaos = request.getParameterValues("aihao");
		
		if(name!=null && password!=null && aihaos!=null){
			response.getWriter().write("name=" + name + "<br/>");
			response.getWriter().write("password=" + password + "<br/>");
			for(String s : aihaos){
				response.getWriter().write("aihao=" + s + "<br/>");
			}	
		}
		*/
		
		Enumeration enums = request.getParameterNames();
		while(enums.hasMoreElements()){
			String name = (String) enums.nextElement();//name/password/aihao
			String[] values = request.getParameterValues(name);//"jack","123","abc"
			System.out.print(name + "->");
			for(String s : values){
				System.out.print(s);
			}
			System.out.println();
		}
	}
}



package cn.itcast.web.request;

import java.io.IOException;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.BeanUtils;

public class Demo4 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		/*
		 * http://localhost:8080/day08/Demo4?username=jack&password=123
		 */
		BeanUtils bu = new BeanUtils();
		User user = new User();
		Enumeration enums = request.getParameterNames();
		while(enums.hasMoreElements()){
			String name = (String) enums.nextElement();
			try {
				bu.setProperty(user,name,request.getParameter(name));
			} catch (Exception e) {
				throw new RuntimeException("参数装配出错");
			}
		}
		System.out.println("用户名:"  + user.getUsername());
		System.out.println("密码:"  + user.getPassword());
	}
}



防盗链

package cn.itcast.web.request;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo5 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		//取得客户端点击下载功能页面来自于哪里
		String referer = request.getHeader("referer");
		if(referer!=null && referer.equals("http://localhost:8080/day07/index.html")){
			response.setHeader("content-disposition","attachment;filename=aaa.jpg");
		}else{
			response.sendRedirect("/day07/fail.html");
		}
	}
}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>index.html</title>
    <meta http-equiv="content-type" content="text/html; charset=GB2312">
  </head>
  
  <body>
  	<a href="/day07/Demo5">下载</a>
  </body>
</html>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>index.html</title>
    <meta http-equiv="content-type" content="text/html; charset=GB2312">
  </head>
  
  <body>
  	<a href="/day07/Demo5">下载</a>
  </body>
</html>

表单输入项数据的获取

package cn.itcast.web.request;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo6 extends HttpServlet {
	public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		
		String username = request.getParameter("username");
		String password = request.getParameter("password");
		String gender = request.getParameter("gender");
		String[] aihao = request.getParameterValues("aihao");
		String city = request.getParameter("city");
		String upfile = request.getParameter("upfile");
		String msg = request.getParameter("msg");
		String id = request.getParameter("id");
		
		int index = upfile.lastIndexOf("\\");
		String filename = upfile.substring(index+1);
		
		System.out.println("username="  + username);
		System.out.println("password="  + password);
		System.out.println("gender="  + gender);
		for(String s : aihao){
			System.out.print(s + "|");
		}
		System.out.println("\ncity="  + city);
		System.out.println("upfile="  + filename);
		System.out.println("msg=" + msg);
		System.out.println("id=" + id);
	}
}


POST请求参数的中文乱码问题 

package cn.itcast.web.request;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo7 extends HttpServlet {
	public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		//修改[请求体]的中文编码
		request.setCharacterEncoding("UTF-8");
		//取得表单输入输
		String username = request.getParameter("username");
		//显示在浏览器
		response.setContentType("text/html;charset=UTF-8");
		response.getWriter().write("姓名:" + username);
	}
}


URL地址的编码(GET方式对中文数据而言)

package cn.itcast.web.request;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo8 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		//request.setCharacterEncoding("UTF-8");
		String username = request.getParameter("username");
		
		/*
		 * 手工将ISO8859-1的编码以UTF-8的方式查询,从而还原中文
		 */
		byte[] buf = username.getBytes("ISO8859-1");
		username = new String(buf,"UTF-8");
		
		response.setContentType("text/html;charset=UTF-8");
		response.getWriter().write("姓名:" + username);
	}
}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>新用户注册</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  
  <body>
	<a href="/day07/Demo8?username=小王">提交</a>	
  </body>
</html>


使用转发,模拟MVC设计模式

package cn.itcast.web.request;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//控制器
public class Demo9 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		/*
		 * http://localhost:8080/day07/Demo8回车
		 */
		System.out.println("Demo9::doGet()");
		
		//调用模型
		Model m = new Model();
		boolean flag = m.check();
		
		if(flag){
			//转发
			RequestDispatcher rd = request.getRequestDispatcher("/view.html");
			rd.forward(request, response);
			//response.sendRedirect("/day07/view.html");
		}
	}
}
	如果在调用forward方法之前,在Servlet程序中写入的部分内容已经被真正地传送到了客户端,forward方法将抛出IllegalStateException异常。
	如果在调用forward方法之前向Servlet引擎的缓冲区(response)中写入了内容,只要写入到缓冲区中的内容还没有被真正输出到客户端,forward方法就可以被正常执行,原来写入到输出缓冲区中的内容将被清空,但是,已写入到HttpServletResponse对象中的响应头字段信息保持有效。 
	

package cn.itcast.web.request;

//模型
public class Model {
	public boolean check(){
		System.out.println("Model::check()");
		return true;
	}
}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>index.html</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  
  <body>
	视图显示正确
  </body>
</html>


使用包含,将网页信息分为头/体/尾三部份处理


package cn.itcast.web.request;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//负责产生该网站中所有网页的页头
public class HeaderServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = response.getWriter();
		out.write("<a href='#'>首页</a>&nbsp;&nbsp;&nbsp;");
		out.write("<a href='#'>购物车</a>&nbsp;&nbsp;&nbsp;");
		out.write("<a href='#'>用户注册</a>");
		out.write("<br/>");
	}
}


package cn.itcast.web.request;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//负责产生该网站中所有网页的页尾
public class FooterServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		PrintWriter out = response.getWriter();
		response.setContentType("text/html;charset=UTF-8");
		out.write("<a href='#'>关于我们</a>&nbsp;&nbsp;&nbsp;");
		out.write("<a href='#'>联系我们</a>&nbsp;&nbsp;&nbsp;");
		out.write("<a href='#'>法律声明</a>");
		out.write("<br/>");
	}
}


package cn.itcast.web.request;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		//包含网页头
		request.getRequestDispatcher("/HeaderServlet").include(request, response);
		
		response.setContentType("text/html;charset=UTF-8");
		response.getWriter().write("用户登录");
		response.getWriter().write("<br/>");
		
		//包含网页尾
		request.getRequestDispatcher("/FooterServlet").include(request, response);
	}
}

将信息存储到request容器对象中

package cn.itcast.web.request;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo101 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		/*
		 * http://localhost:8080/day07/Demo101?name=jack回车
		 */
		String name = request.getParameter("name");
		
		//将信息存储到request容器对象中
		request.setAttribute("NAME",name);
		
		//向浏览器输出内容
		response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = response.getWriter();
		out.write("中国");
		out.flush();
		//out.close();
		
		request.getRequestDispatcher("/Demo102").forward(request, response);
		//response.sendRedirect("/day07/Demo102");//客户端 
	}
}

package cn.itcast.web.request;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo102 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		//从request容器对象中根据key取得信息
		String name = (String) request.getAttribute("NAME");
		response.getWriter().write("name=" + name);
	}
}

重定向

package cn.itcast.web.response;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginServlet extends HttpServlet {
	public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		
		System.out.println(request.hashCode());
		
		//取得表单中填入的用户名和密码
		String username = request.getParameter("username");//浏览器->服务器的请求
		String password = request.getParameter("password");
		if("jack".equals(username) && "123".equals(password)){
			//重定向到ShowServlet
			response.sendRedirect("/day07/ShowServlet");
			
			//重定向到success.html
			//response.sendRedirect("/day07/success.html");
			//以下二句代码的组合,与response.sendRedirect()等价
			//response.setStatus(302);
			//response.setHeader("locotion","/day07/success.html");
			
		}else{
			response.sendRedirect("/day07/fail.html");
		}
	}
}

package cn.itcast.web.response;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ShowServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		System.out.println(request.hashCode());
		response.setContentType("text/html;charset=UTF-8");//响应头
		response.getWriter().write("登录成功");//字符方式显示//响应体
		//response.getOutputStream().write("success".getBytes());//字节方式显示
	}
}


观察Cookie特证

package cn.itcast.web.cookie;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Demo1 extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
		//产生Cookie
		Cookie cookie = new Cookie("name","jack");
		//以秒为单位,设置Cookie的存活时间
		cookie.setMaxAge(7*24*60*60);
		//写入浏览器的缓存
		response.addCookie(cookie);
	}
}


注册页面

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>新用户注册</title>
    <meta http-equiv="content-type" content="text/html; charset=GB2312">
  </head>
  
  <body>
	<form action="/day07/Demo6" method="post">
		<table border="1" align="center">
			<caption>新用户注册</caption>
			<tr>
				<th>用户名</th>
				<td><input type="text" name="username"/></td>
			</tr>
			<tr>
				<th>密码</th>
				<td><input type="password" name="password"/></td>
			</tr>
			<tr>
				<th>性别</th>
				<td>
					<input type="radio" name="gender" value="male" checked/>男
					<input type="radio" name="gender" value="female"/>女
				</td>
			<tr>
				<th>爱好</th>
				<td>
					<input type="checkbox" name="aihao" value="sing"/>唱歌
					<input type="checkbox" name="aihao" value="dance"/>跳舞
					<input type="checkbox" name="aihao" value="play"/>打球
					<input type="checkbox" name="aihao" value="run"/>跑步
				</td>
			</tr>
			<tr>
				<th>你所在的城市</th>
				<td>
					<select name="city">
						<option value="bj">北京</option>
						<option value="sh">上海</option>
						<option value="gz" selected>广州</option>
						<option value="cq">重庆</option>
					</select>
				</td>
			</tr>
			<tr>
				<th>选择需要上传的文件</th>
				<td><input type="file" name="upfile"></td>
			</tr>
			<tr>
				<th>你的留言</th>			
				<td>
					<textarea rows="4" cols="20" name="msg"></textarea>
				</td>
			</tr>
			<tr>
				<td>
					<input type="hidden" name="id" value="20110221"/>
				</td>
			</tr>
			<tr>
				<td>
				</td>
				<td>
					<input type="submit" value="提交"/>
						&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="reset" value="重填"/>
				</td>
			</tr>
		</table>
	</form>	
  </body>
</html>




今日总结

*1 重定向
  response.sendRedirect("/day07/需要重定向到的目标资源位置");
    例如:response.sendRedirect("/day07/success.html");
    例如:response.sendRedirect("/day07/ShowServlet");
  浏览器发放二次请求
  浏览器地址栏前后变化
  web服务器先后产生不同的request对象

  错误提示:
  405:
请求类型与方法不配对
  java.lang.IllegalStateException: getWriter() has already been called for this response
response.getWriter()和response.getOutputStream()只有选用其中一个,不能同时使用

2 response细节
  1)正确选用字符输出和字节输出
  2)不能同时使用字符输出和字节输出
  3)输出时会将响应头和响应体一通输出给浏览器
  4)response产生的流对象在web服务器销毁response对象前,后自行关闭
 

3 StringBuffer
  线程安全,即多个线程并发访问该变量时,不会产生错误问题。
  可变字符,即适合于大量的增,删,改,查操作,不会产生新的变量。
  String(不可变,即适合于查询操作)
  StringBuilder(课后自行完成)
一个可变的字符序列。此类提供一个与 StringBuffer 兼容的 API,但不保证同步。该类被设计用作 StringBuffer 的一个简易替换,用在字符串缓冲区被单个线程使用的时候(这种情况很普遍)。如果可能,建议优先采用该类,因为在大多数实现中,它比 StringBuffer 要快。

  http://localhost:8080/day07/Demo1?name=jack&password=123
  URL      :http://localhost:8080/day07/Demo1
  URI      :/day07/Demo1
  查询字符串:name=jack&password=123

4 request常用API
  URL/URI/RemoteAddr/RemotePort/LocaleAddr/LocalePort/...

*5 取得客户端请求头内容和请求体内容
  获得客户机请求头
   getHeader(string name)方法:String
   getHeaders(String name)方法:Enumeration
   getHeaderNames()方法:Enumeration
   获得客户机请求参数(即,客户端提交的数据)
   getParameter()方法:String
   getParameterValues(String name)方法:String[]
   getParameterNames方法+BeanUtils框架:Enumeration

*6 Request的应用
  1)防盗链
  2)各种表单输入项数据的获取

*7 POST和GET请求参数的中文处理
  1)POST
    记住三点一致:
a)<meta http-equiv="content-type" content="text/html; charset=UTF-8">
b)request.setCharacterEncoding("UTF-8");修改[请求体]的中文编码,如果内容在请求头,该行代码不起住用
        c)response.setContentType("text/html;charset=UTF-8");

  2)GET
/*
* 手工将ISO8859-1的编码以UTF-8的方式查询,从而还原中文
*/
byte[] buf = username.getBytes("ISO8859-1");
username = new String(buf,"UTF-8");
        <a href="/day07/Demo8?username=<%=URLEncoder.encode("小王","UTF-8")%>">提交</a>

8 request细节
  0)请求对象
  1)request容器对象/范围对象
    request对象的方式比较:
    getHeader(String)
     取得请求头   
    getParameter(String)
     取得请求参数
    getAttribute(String)
     取得request容器对象的属性的值
  2)在forward()方法不要有任何的输出代码
 
*9)转发与重定向的区别
  1)转发在WEB网站内,重定向在WEB网站内外
  2)对于重定向,/表示webapps;对于转发,/表示当前web应用名,即day07
  3)重定向地址栏前后变化,转发地址栏前后不变
  4)重定向知道web服务器内部变化,转发不知道web服务器内部变化
  5)重定向request对象前后不一致,转发request对象前后一致,response也一样
  6)代码
重定向:response.sendRedirect()
转发:request.getRequestDispatcher().forward()

10)包含
   类似于Java中的方法调用,最终流程还会回到Servlet中
   乱码原因:在GET方式下,中文出错,需要手工强制转换,参照7知识点  


11)会话的定义
   在同一个浏览器的一次或多次向web服务器的请求的过程,叫会话
   ServletContext容器对象/范围对象
   HttpServletRequest容器对象/范围对象
   请求头:Cookie: name=jack
   响应头:Set-Cookie: name=jack; Expires=Fri, 11-Mar-2011 09:07:26 GMT
   其中path表示;localhost/day07:但凡访问/day07应用下的所有资源,都会带上cookie,如果访问不是/day07下的所有资源,
   则不会带cookie














  • 大小: 41.6 KB
  • 大小: 23.5 KB
  • 大小: 48.8 KB
  • 大小: 44.6 KB
  • 大小: 40.8 KB
  • 大小: 32.9 KB
分享到:
评论

相关推荐

    Day07_路由_vant组件库使用(1).pdf

    { path: '/my', component: MyMusic }, { path: '/part', component: Friends } ] ``` 4. **创建路由实例**:使用 `VueRouter` 构造函数生成路由对象。 5. **注入到 Vue 实例**:将路由对象注入到 `new Vue` ...

    31天iOS入门源码

    Day 04: What is my IP? Day 05: Count Me In Day 06: Reaction Time Day 07: Speed Dialer Day 08: Flickr KML Day 09: Snow Fall Day 10: Where am I? Day 11: Plumb-Bob Day 12: U Decide Day 13: MyGoogle Day ...

    Vue2.xDay07学习相关代码_vue案例

    在Day07的学习中,你可能已经接触到了如何创建和使用自定义组件,例如定义一个`&lt;my-component&gt;`,并在其他地方通过`&lt;my-component&gt;`标签来引用它。组件的生命周期、属性传递(props)以及事件处理(emit)也是这个...

    He is my sun! I love him

    "C360_2010-09-22 09-07-00.jpg"这个文件名遵循了一种常见的命名惯例,用于记录照片的拍摄信息。"C360"可能代表相机型号或者拍摄的视角,比如360度全景;"2010-09-22"是日期,表示这张照片拍摄于2010年9月22日;"09-...

    高考英语3500单词第07讲(单词速记与拓展).pdf

    - **例句**: I ride my bicycle to work every day.(我每天骑自行车上班。) #### 8. **bid** - **释义**: 动词和名词,意为“出价,投标”。 - **联想记忆**: `bid`: 必得。老板下令,这次投标一定要成功,我们...

    sql时间段查询

    FOR i IN 1..LAST_DAY(TO_DATE(month_str, 'yyyy-mm')) LOOP SELECT * FROM my_table WHERE TRUNC(datetime_col) = TO_DATE(month_str || '-' || i, 'yyyy-mm-dd'); END LOOP; END; / ``` 调用该存储过程时...

    SQL Server中的函数

    - `DATEPART`: 提取日期的特定部分,如天、月、年等,例如`DATEPART(day, '07/12/28')`返回28。 - `GETDATE`: 获取当前系统的日期,如`GETDATE()`返回当前日期。 - `DATEADD`: 在日期上增加指定的时间间隔,如`...

    用javascript编写一个自动增加显示时间的例子

    document.getElementById(getid).innerText = year + "年" + myMonth + "月" + myday + "日 " + myHours + ":" + myMinutes + ":" + mySeconds + " " + weekday; ``` 这种方式简单明了,易于理解和维护。 综上所述...

    MySQL计划任务(事件调度器) Event Scheduler介绍

    `或在MySQL配置文件(my.ini或my.cnf)中设置`event_scheduler=ON`来开启。在启动MySQL服务时,也可以通过命令行参数`--event_scheduler=1`来启用。 创建事件(CREATE EVENT)的基本语法如下: ```sql CREATE EVENT ...

    sqlite常用sql语句

    - **语法**: `SELECT julianday('now') - julianday('1776-07-04');` 计算从美国独立宣言签署至今的天数。 - **语法**: `SELECT strftime('%s', 'now') - strftime('%s', '2004-01-01 02:34:56');` 计算从特定...

    Hive开发规范及要点

    2. 使用Hive命令行模式导出数据:使用`hive -e "select day_id,user,count from user_table where day_id in ('2014-03-06','2014-03-07','2014-03-08','2014-03-09','2014-03-10');"&gt; /home/test/test.dat;`语句...

    Get.Smart.Season 1.srt

    Get.Smart.1965.s01e08.The.Day.Smart.Turned.Chicken.avi [175.32 Mb] Get.Smart.1965.s01e09.Satan.Place.avi [175.41 Mb] Get.Smart.1965.s01e10.Our.Man.in.Leotards.avi [175.35 Mb] Get.Smart.1965.s01...

    STG (SNMP Traffic Grapher)

    Rotation happens at the end of hour, day, week or month respectively. Configuration Options: Graph: SNMP values: Target Address: e.g myrouter1.mydomain.com Community: e.g public ...

    java技巧

    - `M`:表示月份(例如July或07)。 - `d`:表示一个月中的具体日期(例如12)。 - `H`:表示小时(24小时制,例如0、17)。 - `m`:表示分钟(例如32)。 - `s`:表示秒(例如55)。 - `S`:表示毫秒(例如978)。 ...

    MySQL 获得当前日期时间的函数小结

    set @dt = '2008-09-10 07:15:30.123456'; select date(@dt); -- 提取日期 select time(@dt); -- 提取时间 select year(@dt); -- 提取年份 select quarter(@dt); -- 提取季度 select month(@dt); -- 提取月份 select...

    Spring MVC之@RequestMapping注解详解

    在这个例子中,`{day}`是一个变量,实际请求如`/appointments/2022-06-07`将被映射到这个方法。 2. **method**:用于指定请求的HTTP方法,如GET、POST、PUT、DELETE等。默认情况下,如果不指定,将处理所有HTTP...

    system mechanic Activator v1.0

    the welcome screen, press "start 30-day evaluation period" . * Keys generated by keymaker are not official, they will work only side by side with this tool. * To register offline, check "Subscribe...

    新思微POS连锁超市管理系统(delphi源码控件)

    新思微POS连锁超市管理系统(delphi源码控件)(这次上传的是控件,方便大家学习与二次开发,请大家支持正版)POS收银系统.超市进销存管理系统.网络版.MSSQL2000★Delphi源码 │ ├─超市收银系统pos(无敌打印)for...

Global site tag (gtag.js) - Google Analytics