Tracking number of JSPs a user visits in a session

Hi everyone:
My coworkers and I need to track the number of pages a user visits while visiting our site.
We set a cookie in the login servlet. If they're not logged in and they visit 5 pages, we want to redirect their request for a 6th JSP to "pleaseLogIn.jsp." Here's the problem:
1 -- We want to avoid the following solution: Set a cookie with an int, retrieve that int on
each page, increment it, and reset the cookie with the incremented int. Then, if the int==5,
redirect. This solution would mean putting (or including) the same code onto each page.
2 -- We can't extend our JSP loader (which, in this case, is BEA Weblogic 5.1's loader --
weblogic.servlet.JSPServlet) to track and redirect, because this servlet is private and unsupported.
Given these 2 limitations, does anyone out there have a clever solution? Thanks a million -- Matt

I would avoid using the cookie approach and use the session object.
Integer pagesVisited = (Integer) session.getAttribute("pagesVisited");
if (pagesVisited == null)
pagesVisited = new Integer(0);
pagesVisited = new Integer(pagesVisited.intValue());
if (pagesVisited.intValue() > 5)
response.sendRedirect("login.jsp");
Of course, I would put this into an included page and include it in every page.
In the login.jsp page, you probably want to reset the counter.

Similar Messages

  • Tracking number of users online

    Hi all,
    I'm building a small application where I want to track and display number
    of users logged in to the system. I'm developing the system using form-based authentication
    on Tomcat.
    My initial idea was to create a user object for every user successfully logged in and then add a user object
    to a static array. I'm not sure but I guess there are better ways of tracking number of online users in the
    system.
    I've seen plenty of threads about sessions but failed to find something that helps me with this.
    If anyone can point me in the right direction or point me to articles discussing this, it would be much
    appreciated.
    Cheers
    Erik

    Hi ,
    Thank's for the posting of the code "a_sun". I haven't been able to make any posting until now (been occupied with other tasks).
    I've been implementing a HttpSessionListener just for testing (at the moment this class is counting number of users). This implementation works successfully.
    I still haven't been able to figure out how to pass the username from j_username FORM Authentication to my listener implementation.
    How can I get my SessionListener implementation to get hold on the username of the logged in person?
    When I was not able to solve this, I was thinking of an alternative solution and use the session application scope to store an array or map and then add the user there.
    I would be more comfortable with, if I could solve this using any of the event Listeners from the API.
    I've also been looking at HttpSessionAttributeListener and from my understanding this implementation should be triggered when an attribute is added to the session.
    I tried the following
    HttpSession session = req.getSession()
    session.setAttribute(("test", myName);My HttpSessionAttributeListener is never triggered when I do this. Any suggestions why?
    Thanks
    Erik

  • How do i get a tracking number for my shipment

    i sent my phone in a week ago to get a new one or they were going to repair it but i dont have a tracking number to shipment and my account is saying i dont have a shipment out how do i fix this problem

    Apple always sends a pre-paid shipping box. The tracking number is on the label. If you were not dealing with Apple, then you can contact whomever you shipped the phone to.
    These are user forums. You are not speaking to Apple here. If you shipped to Apple then you can call them directly or you can contact the shipper for help, but we can't really help you.

  • How can i get a tracking number?, How can i get a tracking number?

    Last Friday my mbp was sent out for repair by the apple store. And now I know that I can look at the repair status but it says return pending. It's getting shipped here to my house how do I get a tracking number so i know where it is?

    Call AppleCare with your case number, and ask when it will actually be sent out for shipping, and when you can get a tracking number.  This is just a user to user forum.

  • Requirement Tracking Number Not Transferring to Backend

    SRM 5.0 SP 7 - ECS
    We've configured our system to allow users to enter the tracking number withing the Basic Data section of the cart, however when the PO is created in the backend the tracking number details are not transferred.
    I assumed that this would be standard functionality but obvisouly it's not.
    Any ideas / sample code would be gratefully received.
    Keith

    Hi,
    Please check here :
    https://forums.sdn.sap.com/click.jspa?searchID=5007432&messageID=3851280
    Kind regards,
    Yann

  • Authorization object for requirement tracking number

    I want authorization object for requirement tracking number in PR ME51N.
    I have to make control over User against requirement tracking number that particular user can use this tracking number only while using ME51N.

    Check the t code su21 whether your requirement is fullfill or  not.
    If not make a authorization object with the help of abaper and assign this object to the particular user in their profile.
    Hope this is help.

  • Save tracking number when pur req created in me51n

    Hi All ,
    when i create purchasre req in me51n then it should be save respective tracking number (Tracking number in sales order number from plaf )  when pur req created .
    plz tell me which user exit will help me .
    Thanks
    regards
    Bhavesh

    Hi,
    Try EXIT_SAPLMEREQ_006
    Cheers,
    Surinder

  • I am trying to track my order but cannot find the tracking number?

    I am trying to look for my tracking number where can i find it?

    Were you sent an email or confirmation that your order has been shipped? That should have the tracking number. If there isn't one, contact the store - we are just other users here unfortunately.

  • I has a shipment tracking and the tracking number is not working

    Hello, i just received a shipment notification.But i tried to track the item and it seem the tracking number is not correct.
    Shipping Address
    Yvonne McFadden
    **** NW
    Atlanta GA 30318-4703
    Carrier Name
    UPS
    Tracking Number
    <Personal Information Edited By Host>

    These are user forums. You aren't speaking to Apple here. We cannot help with your problem. Furthermore, you should never post personal information in an open forum. You have provided your address and phone number and full name to any of the millions of users who are on these forums every day.

  • QA33 Change by adding Requisitioner, purchasing group and tracking number

    Hi All
    I have a requirement for the Standard report like QA33. The requirement is that, in the output of QA33,
    The Requisitioner, Purchasing group and Tracking Number should be displayed
    Please give me suggestions to do this
    I searched for User Exits and I found QEVA0004, QEVA0005, QEVA0006, QEVA0007, QEVA0008, QEVA0009, QEVA0010, QLCO0001, QSS10001.
    In the Above which exits I can use and how to implement them
    Pls reply
    Thnx in Advance
    Regards
    P KAMAL

    GSK,
    But for stock components you don't need a Purch.Group...
    Have a look at the following user-exits:
    COZF0001: Change purchase req. for externally processed operation
    COZF0002: Change purchase req. for externally procured component
    PeteA

  • F4 help for "Tracking Number" field at Item Overview level in ME51n

    Dear Experts,
    I want add F4 help in tracking number filed (i.e. BEDNR) at item overview.
    Scenario -
    While creating material Purchase requisition, I have to give the related Service PO number in tracking number filed.
    Client requirement is, drop down list (like F4 functionality) should be there to selct PO number. No manual copy & paste option.
    Can anybody tell me any user exit OR process how I can do this.
    Thanks & Regards,
    MilindK

    This can be achieved by adding a Search help to the Data element BEDNR
    Go  to SE11
    Give data element as BEDNR
    Find is there any Search help or not.
    Example:  Do the same thing for MATNR  .. you will find some search help is associated.
    Same way, ask your abaper to create one elementary help and associate to the BEDNR
    Then  automatically F4 will be available
    Regards.
    Venkat

  • Creating a tracking number for a form

    What's a good (and easy) way to create a random tracking
    number in a form? I would want this to be hidden from the user on
    the HTML form but this tracking number would be processed by the
    script in order to send the user the tracking number in an email.
    The tracking number would be the same length each time but
    randomly generated.

    .oO(Johnny the boy)
    >What's a good (and easy) way to create a random tracking
    number in a form? I
    >would want this to be hidden from the user on the HTML
    form but this tracking
    >number would be processed by the script in order to send
    the user the tracking
    >number in an email.
    If it's in the HTML form, it's not really hidden. Even hidden
    form
    fields can be seen and manipulated. Instead generate the
    number on the
    server when you process the form data and keep it there,
    never send it
    to the client in an HTML form.
    > The tracking number would be the same length each time
    but randomly generated.
    It should not be purely random, but be build using the
    current timestamp
    to avoid collisions. Or simply incremental, for example with
    the current
    year at first if you don't like too-short numbers:
    2009-1
    2009-2
    2009-3
    2010-1
    2010-2
    2010-3
    There are a hundred ways, just don't make them purely random.
    These
    numbers should be unique, which randomness can't guarantee.
    Micha

  • Update tracking number through : BADI ME_REQ_Posted

    HI ALL,
    greetings.
    i had a query .
    i have to update the table EBAN and update the field
    tracking number(EBAN-BEDNR)at the line item level in the
    TCODE : ME52N.
    i have already generated a number through number range .and want to populate the tracking number and subsequently update table EBAN at SAVE Button of ME52n.
    you can find the field tracking number at the line item under the tab contact person in the tcode me52n.
    i would appreciate any help from ur side
    thanks in advance.
    Gaurav.

    Hello Gaurav,
    Try using user exit 005(EXIT_SAPLMEREQ_005) which is fired for each item. U can incorporate ur logic to generate the tracking number in this exit.

  • Got no Tracking Number for my sent back iPhone

    Hey guys,
    I just visited this site and I`m not sure if I'm right in this place.
    I just sent my defect iPhone to the support, and now i got the notification, that my repaired
    phone was sent back.
    The problem is, that there's no UPS Tracking Number linked to this, so I can't follow the progress
    of shipping.
    How can I receive the Tracking Number? Would be great to get some feedback from the
    community

    Call Apple Support and discuss the issue with them. That's the only way you're going to be able to get a tracking number, assuming they can provide one.
    Regards.

  • Song and Artist Info missing under itunes but not in the original file, and putting track number next to certian songs. Help

    i recently updated my itunes...today i opened it up and moticed abuout 100 songs missing...they are now at the bottom of itunes song list with a number next to them with information mission such as this the example below
    01 human                                                                 (this song should have the killers name as artist and cd title, etc)
    01 hosanna     hillsong united                                 (this song should have the cd title to it)
    02 lay me down                                          burning light
    02 leave out all the rest
    02 let it be                       the beatles
    03 papercut
    when i go under the original folders and files in the itunes folder everything is normal no missing info, etc. but under itunes orgnising its picking and choosing the same songs and putting the track number next to it and others songs in the same cd not. plus info missing. under the infor when i click right button all info missing there...but not under original file.
    please help

    A response on this subject from another post:
    It could be that you have inadvertently imported these CDs into iTunes as part of a compilation. If so, the artists won't show in the artists menu on the iPod.
    To check, highlight the tracks on one of the offending artists CDs in iTunes, right click and select "get info". This brings up a multiple song info window, and from there you can check if you have 'yes' in the box marked "part of a compilation".
    If you have, select 'no' instead and click 'ok'. Do this with any CD that has this issue. This will alter the info in iTunes, and you should then connect your iPod and synchronize the changes.
    The problem arises because the information contained on the Gracenote CD Data Base (where iTunes gets all it's album/artist/track info from), is sometimes incorrect. It can show CDs as compilations when in fact they are not.
    ramstigo wrote:
    I had an earlier post on this subject with a similar problem. I tried what you suggested and it worked indeed. You can select the artists from your Ipod on Itunes and after highlighting the artists/albums affected, click NO on the compilation box and the issue is resolved: the artists appear on the list.
    Thank you so much!!!!.

Maybe you are looking for