The method 'request.getParameterNames()' will return an Enumeration of all
the parameter names of the request object, regardless of whether you use the
GET or POST method.

So you could have a JSP scriptlet code that looks something like this:

<%
 // get all the parameter names and their values that got POSTed to this JSP
page
 String paramName = null;
 String paramValue = null;
 for (java.util.Enumeration e = request.getParameterNames();
e.hasMoreElements() ;) {
    paramName = (String)e.nextElement();
    paramValue = request.getParameter(paramName);
    out.println("<br> parameter name is: "+paramName);
    out.println("<br> value for parameter name "+paramName+" is:
"+paramValue);
  }

%>

Note that this code assumes that a parameter only has one value.  If your
parameter is an array of form values, then you need to use the method
'request.getParameterValues(java.lang.String name)' to get the all the
values in the array.

You can take a look at the Servlet 2.2 API for more information about these
methods:
http://www.java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletRe
quest.html

Good luck.

-----Original Message-----
From: Lee Ball [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 07, 2001 7:51 AM
To: [EMAIL PROTECTED]
Subject: Re: How do I get a QueryString out of POST parameters?


The first decision you need to make is whether you want to GET the first
five results or whether you want to get all the results and DISPLAY only
the first five.

In the first instance you need to put something in your JDBC call to limit
the results you get back (you can do it in SQL!). In the second case you
hold all the results in some structure (like a vector) in your bean (or
servlet or whatever) and then your jsp page can make iterating calls along
your vector.

Sorry it's a bit fluffy but that's the basics of it and not knowing how your
project is architected that's the best I can do.

Cheers
Lee




-----Original Message-----
From: ZHU Jia [mailto:[EMAIL PROTECTED]]
Sent: 07 February 2001 15:36
To: [EMAIL PROTECTED]
Subject: How do I get a QueryString out of POST parameters?


Hi,

I'm doing a project using JSP and JDBC right now. I'm trying to show only 5
search result entries on a single page, then have a link which reads "The
Next
5 Entries" or something like that. But the problem is that I get my search
parameters from a HTML form, with POST method, I think there must be an easy
way to construct a link using the parameters in the request object without
the
knowledge of the exact name of each parameter.
But I searched long and hard, found nothing:-( Now I'm a little bit
confused,
I thought what I'm trying to do is quite standard stuff, am I missing
something essential here?
Any hints or tips will be highly appreciated, and many thanks in advance!

best regards
ZHU Jia

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to