• 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

Request Attributes and Request Parameters

 
Author
Posts: 47
5
MySQL Database PHP Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I have a list box which allows multiple select. The results allow for pagination. When I move to the next page, the multiple selection does not hold. Only the first selection from the list box comes up in the request parameters. I want the selection(s) to hold through all the pages.
Also if I refresh the page, the list box does not hold the selection(s) at all... can this be changed.

Since this is related to request parameters,
I would want to know is can we add multiple request parameters by the same name?
As in How do I accomplish: ?devicePlatform=iPhone&devicePlatform=iPad&curPage=2

And if someone could make the difference betwen request parameters and attributes clear, it would be helpful.

Thanks,
Kanika.


 
Ranch Hand
Posts: 83
Netbeans IDE MySQL Database Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you try to store the selected object list in the session object so that it is accessible throughout the session
 
Kanika Sud
Author
Posts: 47
5
MySQL Database PHP Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the prompt reply.

vinayak jog wrote:Why don't you try to store the selected object list in the session object so that it is accessible throughout the session



That could be a solution. But I wanted to use request parameters/attributes along with a clear picture of these two.

Also, my question still stands: can we accomplish example.com/abc?p=1&p=2&p=3 If so, how?

In other words, if I want to pass an array as the request parameters/attributes, how do I do it... and in this case how il it appear in the query string?
Thanks,
Kanika
 
vinayak jog
Ranch Hand
Posts: 83
Netbeans IDE MySQL Database Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya you can do it by storing your selected objects in a string and in each JSP you need to access that string and append newly added object to the string but this has a limitation you cannot exceed some number i.e., url cannot be infinitely big, so better you use session object which sufficiently big to hold your data and accessible throughout the session. And passing parameters using url is not good practice
 
Ranch Hand
Posts: 136
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To use the array of values in request parameters use getParameterValues() for example like this ,
Once you store the parameter values retrieve it in next page using loop iterator
 
Kanika Sud
Author
Posts: 47
5
MySQL Database PHP Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sabarish Venkat wrote:To use the array of values in request parameters use getParameterValues() for example like this ,
Once you store the parameter values retrieve it in next page using loop iterator



Let me explain the whole situation because none of these is an exact solution. My fault, really.

The struts tag I'm using looks something like:



Now if I try to paginate between results the following happen:
A single selection holds.
A multiple selection does not.

I suspect it happens because the setter is a String and not an array. I can't change this to an array now because it will lead to a lot of change in existing code.


Thanks,
Kanika.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic