我是JSP web开发的初学者。我有一个登录(Login.jsp)页面为我的网页,其中有标准的登录控件(例如。用户名、密码文本框、“记住我”复选框和一个登录按钮)当用户提供凭据时,在提交详细信息时,调用Authenticate.jsp,其中凭证与数据库匹配,如果正确,则创建该用户的会话,如果凭据不正确。我将用户重定向回response.sendRedirect("./Login.jsp?status=fail");登录页面。
在Login.jsp上,status参数总是被选中,当它给出值fail时,在包含消息User Name or Password Incorrect!的文本
当会话超时时,我重定向到登录页面。我需要这一点,无论登录用户名是相同的用户名,这是在会话超时之前登录,然后页面将被重定向到以前的用户访问的页面从登录页面。
例如,
User name is Admin, when this user is open ContactUs.jsp, after the session timeout the page will be redirect to login.jsp, In login.jsp whether the same Admin user is logged in then, the page is redirect to Co
我正在尝试使用jsp设计一个简单的登录系统。在登录页面中,用户输入他的用户名和密码,在验证时执行
if username and password combination exists, then
{
HttpSession session = request.getSession(false);
if (session == null) {
// Session not created yet. So we do it now.
session = request.getSession();
sessi
在php中,我用来通过检查会话中的成员id来验证用户是否已登录,如果设置为ok,则页面将通过Header重定向到登录页面。这个身份验证脚本是用auth.php编写的,我过去常常把它包含在任何需要登录的页面中。很简单。然而,我不能在jsp中做同样的事情。因为无论auth.jsp执行什么操作,页面的其余部分都会加载,其中包括auth.jsp。auth.jsp是
<%
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user
根据我所读到的内容,检查用户是否已登录的一般方法是在servlet中创建一个filter方法。但是,我想检查用户是否仅在尝试输入特定的jsp文件时才登录。例如,当他在mainpage.jsp中时,我不关心他是否登录,但我只关心他单击mainpage.jsp中显示的指向hello.jsp的链接。我不确定如何将servlet中的过滤器仅应用于特定的jsp。我检查用户是否登录的代码如下:
UserService userService = UserServiceFactory.getUserService();
user = userService.getCurrentUser();
if (use