• 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

getting string of parameters from a http servlet and passing it to stored procedure

 
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi maha,
thanks for your email last time. I got one last question.
I am getting a QueryString from a web page to this SErvlet, different querySTrings will
be generated depending on the different user responses in the webpage. My job in this
servlet is to get the list of parameters and pass them to stored procedures.,
i won't be sure of the parameter names, so i am getting parameters names and values like
this in the Servlet.
Enumeration enum = req.getParameterNames();
while (enum.hasMoreElements()) {
String name = (String) enum.nextElement();
String values[] = req.getParameterValues(name);

if (values != null) {
for (int i=0; i<values.length; i++) {>

out.println(name + " = " + values[i] + "
" );

}
}
}
I am able to print parameter names and parameter values. But what i want is to collect
the parameter values and pass them to a Stored procedure.
If i collect them in while loop, then i am unable to use them outside the while loop.
all i need is a string of parameter values will comma separated. and pass them to stored
procedure.
I am calling stored procedure like this
try{
CallableStatement cs = dbconn.prepareCall("{Call " + proc_name + "(?,?)}" );
}
catch(SQLException e)
{
System.out.println("GOT SOME SQLEXCEPTION" + e.getMessage());
}

cs.execute;
My question.
1. i am unable to collect the parameter values in a STring.
2. how to pass them to stored PRocedure
can u suggest me something
that will be a great help
thanks and sorry for troubling you
it will be a really great help
bhasker
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you post this in the proper forum, you may get an answer.
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bhaskar,
I'm going to move this over to the Servlet forum as it's not related to Certification Study.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
reply
    Bookmark Topic Watch Topic
  • New Topic