&(逻辑语言)
&是逻辑语言,逻辑上表示两者属于缺一不可的关系,还可以表示一个人和另外一个人之意,与and同义。如A&B,表示A与B,A和B,A×B。
以一下URL为例:
http://www.xxx.com/Show.asp?id=77&nameid=2905210001&page=1当中的?的作用是连接作用,&为不同参数的间隔符。
简介:
字符 &的最早历史可以追溯到公元1世纪,最早是拉丁语et (意为and)的连写。最早的 &很像 E 和 T 的组合,随着印刷技术的发展,这个符号逐渐形成自己的样式并脱离其原始影子。在这个字符中,仍能看出E的影子,但是T已经消失不见。
&字符的进化过程,其中 1 更像其原始的连写表示,2 和 3 发展于4 世纪,4 到 6 发展于 9 世纪。到了18世纪,&已经演变为极具装饰性的书法字符。现代的 &基本保留了 &在9世纪的模样。斜体 &是 E 和 T 的后期连写形式,在现代字体中也有,它们是文艺复兴时期曲线字体的产物,看上去更优美一些。在多装&的圆体写法中,所有的&都由两笔写出:从顶端起笔,逆时针向下,拐一个大弧,向上行进并收笔为一个顺时针的圆弧:在从同一位置起笔,直接写出向下一笔,再添加一个装饰性的收尾
表单:<form action="doservlet" method="post">
姓名:<input name="user_name"><br>
性别<input type="radio" value="man" name="sex">男 <input type="radio" value="women" name="sex">女<Br />
爱好:<input type="check" name="likes" value="运动" />运动
<input type="check" name="likes" value="读书" />读书
<input type="check" name="likes" value="音乐" />音乐
<input type="check" name="likes" value="书法" />书法
</form>
servlet:
iimport 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 doservlet extends HttpServlet {
/**
* Constructor of the object.
*/
public doservlet() {
super()
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy()// Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html")
PrintWriter out = response.getWriter()
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">")
out.println("<HTML>")
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>")
out.println(" <BODY>")
out.print("This is ")
out.print(this.getClass())
out.println(", using the GET method")
out.println(" </BODY>")
out.println("</HTML>")
out.flush()
out.close()
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html")
PrintWriter out = response.getWriter()
String name = null
String sex = null
String likes[] = null
name=request.getParameter("user_name")
sex=request.getParameter("sex")
likes=request.getParameterValues("likes")
request.getSession().setAttribute("user_name", name)
request.getSession().setAttribute("sex", sex)
request.getSession().setAttribute("like",likes)
//把请求过来的数据放在session里
response.sendRedirect("目的页")
//在目的页中通过session的 getAttribute方法取出来即可
out.flush()
out.close()
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
// Put your code here
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)