Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Bhasker Reddy
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • 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
 
marilyn murphy
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you post this in the proper forum, you may get an answer.
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic