<%@ page contentType="text/html;charset=GB2312"%>
<HTML><BODY>
<%
response.setStatus(408);
out.println("This is 'welcome1.jsp',can you see this page?");
%>
</BODY></HTML>
访问这个JPS网页依然没问题呀,状态408不应该是访问超时么?
我仔细对了几遍书上的例子,没发现哪里写错。。。
纠结中~~~
JSPresponse.setStatus(408);
答案:1 悬赏:0
解决时间 2021-11-24 15:40
- 提问者网友:冥界祭月
- 2021-11-24 09:02
最佳答案
- 二级知识专家网友:一起来看看吧
- 2021-11-24 09:18
可以用ajax的xmlhttprequest的方法来提交数据
在用户名的textbox加上失去交点事件onblur="checkuser()"
然后在script/script标签中写:
//创建xmlhttprequest对象
if(typeof XMLHttpRequest != 'undefined ') {
httpRequest = new XMLHttpRequest();
}
else if (typeof ActiveXObject != 'undefined ') {
httpRequest = new ActiveXObject( 'Microsoft.XMLHTTP ');
}
function checkuser(){
if(httpRequest) {
httpRequest.open( 'GET ','你要对数据库进行操作的jsp页面chklogin.jsp', false);
httpRequest.send(null);
if(httpRequest.readyState == 4){
if(httpRequest.status == 200)
var strinfo=httpRequest.ResponseText;//在chklogin.jsp中response.write一个可以进行注册的值,这样这个值就可以返回到srinfo中,再在注册页面判断一下这个值就可以用javascript显示了。
}
}
}
这样可以在用户名文本框失去交点的时候调用chklogin.jsp来进行检查用户名,相当于按下了submit按钮。
在用户名的textbox加上失去交点事件onblur="checkuser()"
然后在script/script标签中写:
//创建xmlhttprequest对象
if(typeof XMLHttpRequest != 'undefined ') {
httpRequest = new XMLHttpRequest();
}
else if (typeof ActiveXObject != 'undefined ') {
httpRequest = new ActiveXObject( 'Microsoft.XMLHTTP ');
}
function checkuser(){
if(httpRequest) {
httpRequest.open( 'GET ','你要对数据库进行操作的jsp页面chklogin.jsp', false);
httpRequest.send(null);
if(httpRequest.readyState == 4){
if(httpRequest.status == 200)
var strinfo=httpRequest.ResponseText;//在chklogin.jsp中response.write一个可以进行注册的值,这样这个值就可以返回到srinfo中,再在注册页面判断一下这个值就可以用javascript显示了。
}
}
}
这样可以在用户名文本框失去交点的时候调用chklogin.jsp来进行检查用户名,相当于按下了submit按钮。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯