期終考試題目,國外朋友的,俺不會jsp只好請教大大門 PART 2
B.A website login mechanism.
Create a web application where the user can login and browse the context of a website. Access to the website should not be allowed to non logged in users.
创建一个网络应用,用户能够登陆并且浏览这个网站。没有登陆的用户不能进入该网站。
a.First create a JSP file with all the necessary HTML and JSP elements, and call it index.jsp.
b.Add one text element on the page where the user enters the username and one password element where the user enters the password.
c.Add a submit type button on the page so that when the user clicks on it, the page is submitted to the server. The action of the form element in the page should refer back to the index.jsp page.
d.Before submitting the page, validate (using JavaScript) the following:
i.username and password fields are not empty or contain any white spaces
ii.username and password are longer than 7 characters, but 16 maximum
e.Username and password verification should be done by a session type JavaBean (say login.java) that is called from within index.jsp.
f.Create the login JavaBean and have a function called checkUser(username, password) that will return true if the username and password are correct or false otherwise. The function should also store the username and login result within local variables.
g.Usernames and passwords should already exist in the users table in a database (see Further Information section), and the JavaBean should access the dbConnector.java JavaBean created in part A to access and retrieve the password details.
NOTE: To get started, if you have not / cannot do part A, you can just hardcode(在编程过程中可以把变量赋值为自己造的数据,用于测试) the username and password list within the login.java JavaBean.
h.The login JavaBean should also have other useful functions like a function that returns the login status or a function that returns the username (or full name of user).
i.If the login is successful, then index.jsp should redirect the user to a new page (say main.jsp). Otherwise, if unsuccessful login, the page should keep the user in the login page and display a login failure message.
[解决办法]
MARK
[解决办法]
如果不完全翻译成中文,就别中间穿插几句,看着好麻烦。
[解决办法]
帮忙顶。
[解决办法]
最简单的登录验证
[解决办法]
就是一个用户登陆啊~~用MVC来设计 用脚本语言判断用户名和密码啊~~~楼主你该不会是发贴让我们大家给你贴代码出来吧????
[解决办法]
汗死。。。
最基础的MVC模式的设计,在搜索引擎中可以搜索的到`