Session detection JSP determing content?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Paks
    New Member
    • Dec 2006
    • 13

    #1

    Session detection JSP determing content?

    Hi there,
    developing a web application and got a total mind block.

    I'm using the frameworks hibernate, struts and spring.
    And when you click on a link to a JSP-page, I want to redirect depending on the sessions value, which contains a User-object. Get a value from the object and depending on whether this value is null or not I want to redirect to different JSP-pages.

    Does anyone know how to do this? In which layer should the controll be done?

    The most annoying thing is that I've done a similar thing a couple years ago, but now I have no idea :/

    Thankful for any help.

    -- Paks
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Have a look at the Filter interface; they can intercept requests (and responses
    in the 2.mumble specs) and redirect them to another page.

    You have to implement that interface and declare in your xml file where that filter
    is supposed to be located logically.

    I haven't done anything with that web stuff since years so I can't help you any
    further; sorry for that.

    kind regards,

    Jos

    Comment

    • ajos
      Contributor
      • Aug 2007
      • 283

      #3
      Originally posted by Paks
      Hi there,
      developing a web application and got a total mind block.

      I'm using the frameworks hibernate, struts and spring.
      And when you click on a link to a JSP-page, I want to redirect depending on the sessions value, which contains a User-object. Get a value from the object and depending on whether this value is null or not I want to redirect to different JSP-pages.

      Does anyone know how to do this? In which layer should the controll be done?

      The most annoying thing is that I've done a similar thing a couple years ago, but now I have no idea :/

      Thankful for any help.

      -- Paks
      As said by jos you need a Filter, In order to redirect depending upon session value you need to use HttpSessionList ener, just google around to know about Filters and HttpSessionList eners.

      cheers.

      regards,

      ajos

      Comment

      • Paks
        New Member
        • Dec 2006
        • 13

        #4
        Thanks for your help :)
        The filters had completely slipped my mind, will look in to it right away!

        -- Paks

        Comment

        Working...