jsf 统计在线用户
最近学习用JSF框架
写了个登录页面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<html>
<head>
<title>Insert title here</title>
</head>
<body background="../images/back_blue.gif">
<f:view>
<h:form>
用户名:<h:inputText value="#{people.name}"></h:inputText><p>
密 码:<h:inputSecret value="#{people.passWord}"></h:inputSecret><p>
<h:outputText value="#{people.errMessage}"></h:outputText><p>
<h:commandButton value="submit" actionListener="#{people.verify}" action="#{people.onLine}"/>
</h:form>
</f:view>
</body>
</html>
写了个USER类 在页面上直接调用USER类的属性 进行登录验证 这个实现了
但我想在登录的时候 创建一个SESSION 使用监听器来统计当前在线的人数
下一布 不知道怎么做 是在USER类里面写创建SESSION的代码吗?
我点按钮的时候 调用 people.verify 这个方法验证
如下
public void verify(ActionEvent e) {
if(!name.equals("zhaozheng") ||
!passWord.equals("123456")) {
errMessage = "名称或密码错误";
onLine = "failture";
}
else {
onLine = "success";
}
}
我主要想实现在线人数统计 现在不知道在做 ?