• 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

urgent!! request.getParameter()

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i have a form with 60+ paramters. I dont want to manually do request.getParameter(param) on each one of them....is there any other way to handle this....Please help
Thanks
[ May 07, 2003: Message edited by: Dolly Patel ]
 
Ranch Hand
Posts: 5399
1
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use struts framework and eclipse[to genrate get/set methods]
else you can use req.getParameterNames() or getParameterMap() .. but still I think you have to write those 60+ html elements at some point of time.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adopting a framework just to auto-generate a handful of statements seems a bit extreme.
It might be helpful if you'd let on just what is you need to do with the 60+ parameter values.
hth,
bear
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Dolly,
Here are 2 ways from my code-snippet-collection to simplify checking parameters for null:

hth cb
 
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think should used like this..
<jsp:setProperty name="entry" property="*" />
fix me..
 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is one other way that I use a LOT when handling big requests likle this. Use:
req.getParamterNames() which returns an Enumeration of the incoming names along with a Hashtable to grab the incoming values like this:
Enumeration enum = req.getParameterNames();
Hashtable myInfo = new Hashtable();
while (enum.hasMoreElements()) {
String name = enum.nextElement();
myInfo.put(name, req.getParameter(name));
}
This is great when you have a ton of paramaters coming in & dont want to go thru the manual grabbing of every last one (OH what a pain)
Once you have everything in the Hashtable you can test & run thur them in a loop & away you go!....hope this helped.
[ May 08, 2003: Message edited by: DC Dalton ]
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Common Dolly,
Do'nt be so lazy, especially when u have tools like textpad and keys like ctrl,C and V.
 
Rohit Ahuja
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i was just wondering whether ur field names are more or less the same.
If they r X1,X2... then u could loop them thru a for loop and pass it to request.getparameter();
for( int i = 0; i < 60 ; i++ )
{
S.O.P( request.getparameter("X"+i) );
}
This is just the skeleton,does it help??
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dolly,
May be using a javabean for the display is a good idea to populate all the form fields.
-Kaustubh.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic