Hello, After receiving some excellent help on my other topic, I thought I'd try here again. This problem is related to the application I am making in my other thread, but you needn't know the specifics. I'll just give you the necessary information.
The webapp has to register hits and those have to be shown on a page named Statistieken.jsp (which is located in /pages). This works. My setup is as follows: The user visits /Statistieken (via the link going to /Statistieken), then StatistiekServlet gathers the necessary data (HTTP headers, URIs, etc.), stores it in a MySQL database (a rather simple and not normalised one...) and is done. In web.xml I have /Statistieken mapped to the StatistiekServlet. Apparently, I have to track when a specific user last visited the page. And I have to do that with cookies (yes, cookies...). So my idea is as follows: a class, CookieServlet, uses getCookies() to return a cookie array. If it's empty, there are no cookies set and a cookie with the current number of hits for the statistics page will be set and the statistics page will be shown. If it's not, I iterate through it until I find the cookie I want. The value in there (which is always a number to make things easier for me...) is placed in an int with String.valueOf(). Then I use some basic SQL to determine the current number of hits, substract the value in the cookie from the current number of hits to determine how many visitors there have been since that person's last visit. My questions are as follows: - How can I get Statistieken.jsp to get the result of the subtraction without using too much Java code in my JSP document? I'm thinking of making an instance of the CookieServlet class and then calling the method that returns the result of the subtraction and placing that in the JSP with a scriptlet. Is this possible? And if so, is this the proper way for an MVC structure? - Given a Servlet that gets the records from the database, how do I get the results in the ResultSet in the Servlet to the JSP and how do I iterate through them without coding too much logic in the JSP? Do I use tags or is there some easier method? Thanks for your help and if you need clarification: Ask away! -- View this message in context: http://www.nabble.com/Cookies-in-Servlets-and-redirecting-Servlet-results-to-a-JSP.-tf2692424.html#a7507983 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]