jsp中怎样实现打开网页前弹出验证框?(100分)

  • 主题发起人 westbird
  • 开始时间
W

westbird

Unregistered / Unconfirmed
GUEST, unregistred user!
请问:
jsp中怎样实现打开网页前弹出验证框?
验证通过才能打开网页.
 
<body onload="javascript:load()">
<script language="javascript">
functon load(){
alert("hello");
}
</script>
 
这好象不是弹出验证框呀!
 
请更详细地描述您的问题。
建议您先阅读这篇公告:
提问的智慧 (How To Ask Questions The Smart Way)
http://www.delphibbs.com/delphibbs/dispq.asp?lid=1018713
 
westbird 的问题好像有些模糊,不知道以下的回答对你有没有帮助。
假设我们在A页面中进行了信息的输入,然后转到B页面中进行处理(比如和数据库的交互)
在B页面(b.jsp)中我们就可以这样写:首先request.getParameter("parameter");如果条件符合
则进行下一步操作,如果有问题,比如类型不匹配,或者其他什么的,就可以写一段java
script 代码,向曹晓钢那样:out.println("<script language=/"java script/">");
out.println(alert(/"数据类型不匹配/"));out.println("</script>");这样就可以了。
 
有很多方式实现顶楼的要求。比如使用http server本身的realms.
 
对不起!
我没说清楚,我是想 象某些ftp或其它有权限要求的站点那样,用户访问前先需要输入合法
用户名和密码,才能出现他们需要的内容.而这个身份验证框需要弹出而不是网页上的form.
不知我是否说清楚了.
 
那么你需要的就是http server 的用户验证.
你用的是apache 还是IIS?他们的设置是不一样。
如果是Apache,那么有几种选择,Apache支持几种不同的模块,可以是把用户名和密码放在一个文本文件里,
也可以从数据库比如mysql去读。具体的,请看这篇文档:
http://httpd.apache.org/docs/mod/index-bytype.html
其中的如下部分:
Access Control
mod_access
Access control based on client hostname or IP address
mod_auth
User authen
tication using text files
mod_auth_dbm
User authen
tication using DBM files
mod_auth_db
User authen
tication using Berkeley DB files
mod_auth_anon Apache 1.1 and up
Anonymous user access to authen
ticated areas
mod_auth_digest Apache 1.3.8 and up
Experimental MD5 authen
tication
mod_digest Apache 1.1 and up
MD5 authen
tication
请按照你的需要阅读不同的部分。
 
谢谢你们,谢谢曹晓钢!
 
多人接受答案了。
 
顶部