0

how can i write a code which counts to me number of visits a user had to site, and total number of visits to that site from all users.

1
Contributor
1
Reply
3
Views
8 Years
Discussion Span
Last Post by hajjo
0

here is code i have written

count.jsp

<%@page import="dayexercises.counter"%>

<jsp:useBean id="acounter" class="dayexercises.counter" scope="session" />

<jsp:setProperty name="acounter" property="*"/> 



<jsp:useBean id="acounter1" class="dayexercises.counter" scope="application" />
<jsp:setProperty name="acounter1" property="*"/>


<%
out.println("Number of visits session");
acounter.increaseCount();
out.println(acounter.getCount());
out.println("Number of visits application");

acounter1.increaseCount();

int y =acounter1.getCount();
out.println(y);

%>

and counter.java

package dayexercises;


public class counter {
	int count;

	public int getCount() {
		return count;	
	}

	public void increaseCount() {
		count++;
	}
}

session is working, but application isnt working. when i open page it counts.. then after i close, the application is supposed to keep all counts but its not working. solutions?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.