aspose file tools*
The moose likes Servlets and the fly likes getting string of parameters from a http servlet and passing it to stored procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "getting string of parameters from a http servlet and passing it to stored procedure" Watch "getting string of parameters from a http servlet and passing it to stored procedure" New topic
Author

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

Bhasker Reddy
Ranch Hand

Joined: Jun 13, 2000
Posts: 176
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

Bhasker Reddy
marilyn murphy
Ranch Hand

Joined: Aug 28, 2001
Posts: 84
If you post this in the proper forum, you may get an answer.
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
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


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting string of parameters from a http servlet and passing it to stored procedure