• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Example on Session Handling

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am learning struts. I am attempting an work that records the recently used value from the pulldown menu and display the pulldown menu in the order of recently used one first and the others later, i would like to know how to include this using Action classes.

Kindly provide example code or steps to achieve it.

I require some links on session handling implementation in struts framework.

thanks in advance.

Regards
Roshini
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
take a form bean with setter getter methods for pulldown menu. now bind it with action in session scope. see below code..

by default the scope for formbean is session. so no need to write scope="session" in action tag.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's what I'd suggest:
  • Each time the user makes a selection, save it in a cookie on the user's browser.
  • when you're preparing the display of the dropdown, get the list of options from the database and then retrieve the value from the cookie if it exists
  • Add the option from the cookie as the first value in the list
  • Add each item in the list except the one already added
  • Now that you have a list of options, save it in either request or session scope and use a combination of <html:select> and <html:optionscollection> tags to display the dropdown


  • [ January 30, 2007: Message edited by: Merrill Higginson ]
     
    Roshini Sridharan
    Ranch Hand
    Posts: 143
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hai,

    Thanks a lot for your suggestion, i will try that out.

    Regards
    Roshini
     
    Greenhorn
    Posts: 17
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi
    I have a one Doubt . How to handle the seesion in struct frame work. Any one can help me.

    With regards
    Premkumar
     
    reply
      Bookmark Topic Watch Topic
    • New Topic