what is alternative of hidden variable(structs)????


Web tier: servlets, JSP, Web frameworks: what is alternative of hidden variable(structs)????

  1. i am using structs,bean.
    in the first page i am adding data and going to second page
    if i have to change something i have to come back to first jsp page.

    i have made the Bean,Action and Form classes too.
    I am doing setAttribute( in Action.java) and getAttributes(in first.jsp file) also
    when i am adding data to first page and preview it
    after coming back to modify i am not getting the data.

    but if i am using hidden prop i got the data.
    but i donot want to use hidden property.
    how can i get data without using hidden property.


    Threaded Messages (2)

  2. Although I'm not exactly sure of what you're asking, it sounds like something many new Struts users have trouble understanding at first.

    When you put data into the request, it's only present in the request until the response is rendered to the page. Once that happens, any future attempt to access data from the request is futile. If you need the data to live longer than the request, there are several options:

    1) Store it in the HttpSession
    2) Store it as hidden variables in the page
    3) Store it in some other persistence cache (like a database)

    There's also a difference in how forwards and redirects work. This difference has been the cause of many a frustrations for developers.

    If this doesn't answer your question (which i doubt it did), please post more information and I'll be glad to help more.

    Chuck Cavaness
    Author of Programming Jakarta Struts by O'Reilly
  3. session[ Go to top ]

    I think the simplest way is storing the bean in the session (although it is not a very good habit)