do
{
i=i+1
if(i===6)
}
先让i+1再判断就可以了
do...while循环是
while
循环的变种。该循环程序在初次运行时会首先执行一遍其中的代码,然后当指定的条件为
true
时,它会继续这个循环。所以可以这么说,do...while
循环为执行至少一遍其中的代码,即使条件为
false,因为其中的代码执行后才会进行条件验证。
分析:先执行的一遍
do{
result=patt1.exec("The
best
things
in
life
are
free")
document.write(result)
}
这时页面上就是eeeeee,接着while判断result不为空,又执行do,这时指针已经到了末尾,返回null,document.write(result)就打印了null
doget方法。每个Servlet一般都需要重写doGet方法,因为父类的HttpServlet的doGet方法是空的,没有实现任何代码,子类需要重写此方法。
form里面
method="post"---------->dopost
method="get"---------->doget
<form method=post name=form1>
<a href=1.asp?abcd=abcd>是get
扩展资料:
一般来说我们是用不到doGet方法的,doGet方法提交表单的时候会在url后边显示提交的内容,所以不安全。而且doGet方法只能提交256个字符(1024字节),而doPost没有限制,因为get方式数据的传输载体是URL(提交方式能form,也能任意的URL链接),而POST是HTTP头键值对(只能以form方式提交)。
通常使用的都是doPost方法,你只要在servlet中让这两个方法互相调用就行了,例如在doGet方法中这样写:
public void doGet(HttpServletRequest request, HttpServletResponse response)
hrows ServletException, IOException {
doPost(request,response)
}