Menu

Question on using DISPLAYTAG properties

savoym
2008-01-11
2012-10-09
  • savoym

    savoym - 2008-01-11

    Is there a way to utilize displaytag properties or utilities of any kind to allow a user to get back to the SEARCH FORM with all the selected criteria still checked that brought me to the page where I have a displaytag table?

    Let me explain further, when I get to the RESULTS page I have a REFINE SEARCH button and when I'm on page 1 I can get to the SEARCH FORM because my REFINE SEARCH button has a history.back() javascript method on it. However if I'm on page 2 or 3 or the last page when I click the REFINE SEARCH button I would like to get back to the SEARCH FORM with all the selected criteria that was there initially.

    Is there a way to do that from any page including page 1 using displaytag properties or utilities?

    ANY HELP or DIRECTION would be greatly APPRECIATED.

    Thank you.

     
    • Honza

      Honza - 2008-01-11

      Hi there,

      I do not know if display tag offers this kind of functionality, but I guess you could do something like that with the framework you are using (Struts/Spring/whatever). Anyway, I do not know if it is the most neat clean solution out there, but it works: you might create a class representing all possible search criteria. When user hits the search button, gather the criteria and store them in your session. Then, when the user goes to the search page, retrieve the selected search criteria from session ...

      Again, I do not know if this is the most clean solution (in case it's not, do not flame me but please explain me why and what is better), but it works...

      Cheers and good luck,
      Honza

       
    • kremso

      kremso - 2008-01-11

      Just do the same trick as displaytag does with the pagination links.

      If you have a form.htm and a results.htm, than the button should point to form.htm, followed by all request attributes.
      For example: form.htm?name=John&age=35&ou=Sales

      Your form.htm will then be populated.

      I hope it helped.

      -Tomas

       
    • savoym

      savoym - 2008-01-11

      Thanks so much for the responses. I was actually trying to avoid using the URL string to capture the info. I was thinking about capturing the info in hidden fields on the subsequent but don't know if that will work.

      I'm new to JSP so I'm not sure how to capture the info in a session(?) but I'll do some googling and find out.

      Thanks again for your time.

      Regards.

       
      • Honza

        Honza - 2008-01-11

        Which framework are you using? Struts? Spring? I am new to spring but I do know struts so I might give you an example on how to do that ...

        Honza

         
        • savoym

          savoym - 2008-01-11

          I am actually using Stripes web framework.

           
          • Honza

            Honza - 2008-01-11

            ok, sorry, I do not know anything about that one ... if I have time this weekend, I'll either try to look at Stripes in short or write you a short description, on how it would work in Struts and you can look for an analogy ...

            I'll send it to you then by message just to you.

            Cheers,
            Honza

             
      • kremso

        kremso - 2008-01-12

        Using hidden fields will work as good, as appending the parameters to url. Just make a form of hidden fields and make sure the form's method is set to post. Then just make the button submit the form.

        Or just use the session (request.getSession().addParameter("name", "John"), then request.getSession().getParameter("name") will yield "John").

         

Log in to post a comment.