You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Dan <da...@porkfriedrice.net> on 2003/07/21 18:48:36 UTC
getting request parameters in search generator using Request.getParameter()
Hi,
I have extended the default search generator that comes with cocoon to
meet my requirements. One of these requirements is that searches can be
limited to certain collections of documents. I implement this with
checkboxes on the HTML form. For example, I have the following form:
[some query______________] query string
[*] Collection 1
[ ] Collection 2
[*] Collection 3
[Submit]
Ok, so when I submit the form the url looks something like this:
http://mymachine.com/webapp/search?queryString=some+query&colls=coll1&colls=coll3
In my search generator I want to get the request parameters so I can
build the proper lucene query. The problem is that my checkboxes have
the same name (colls) and when I try to do a
request.getParameter("colls"), I only get the first checked box. How do
I get them all?
here is the code segment:
// get collections to search
param_name = par.getParameter(COLL_PARAM, COLL_PARAM_DEFAULT);
if (request.getParameter(param_name) != null) {
collection = request.getParameter(param_name);
}
System.out.println(collection);
So, using the query generated by my sample form above, I would see
"coll1" printed in the logs and not coll3. I need to get both. How is
this done?
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: getting request parameters in search generator using Request.getParameter()
Posted by Geoff Howard <co...@leverageweb.com>.
Dan wrote:
...
> In my search generator I want to get the request parameters so I can
> build the proper lucene query. The problem is that my checkboxes have
> the same name (colls) and when I try to do a
> request.getParameter("colls"), I only get the first checked box. How do
> I get them all?
>
> here is the code segment:
>
> // get collections to search
> param_name = par.getParameter(COLL_PARAM, COLL_PARAM_DEFAULT);
> if (request.getParameter(param_name) != null) {
> collection = request.getParameter(param_name);
> }
>
> System.out.println(collection);
>
> So, using the query generated by my sample form above, I would see
> "coll1" printed in the logs and not coll3. I need to get both. How is
> this done?
String[] getParameterValues(String name)
Returns an array of String objects containing all of the
values the given request parameter has, or null if the parameter does
not exist.
from
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/environment/Request.html
and
http://cocoon.apache.org/2.0/apidocs/org/apache/cocoon/environment/Request.html
Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org