File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Does getParameterValues have a Limit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Does getParameterValues have a Limit" Watch "Does getParameterValues have a Limit" New topic
Author

Does getParameterValues have a Limit

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
I am building a select list on a JSP. Before I submit I select all the items and it shows to have 25 items selected. In my servlet I do:

String [] getPickListArray = arg0.getParameterValues("pickItemList");
getPickListArray.length

It only shows 24.

Any ideas?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

Is your request being submitted as a GET or POST? The former has severe limitations on length.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

Did you really name your request parameter arg0?
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
This is my code:

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

If you're not going to answer questions, you're unlikely to get problems solved. I ask again, is this a GET or POST request?

Yes, you are showing us the doPost code, but it's common for doGet handlers to route to the doPost. So what is the actual method type of the request?

(And really, arg0 and arg1?)
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
I suppose I did not understand what you were asking and I could still be confused. This is how I call the servlet from the JSP:

document.pickbuildform.action= "/ShippingDocsWebApp/PickListOptionsServlet";
document.pickbuildform.submit();

As far as the arg0, arg1 I think the answer is yes.

Please forgive me of my lack of knowledge. I am really trying to learn.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

Originally posted by Steve Dyke:
I suppose I did not understand what you were asking and I could still be confused


OK, you really need to know the difference between a GET and a POST. Search google for "HTTP methods".

If your form tag does not specify a nethod, it defaults to GET. I suspect your problem will be fixed by adding

to your <form> tag.

Please do your HTTP research to understand why it makes a difference!

As far as the arg0, arg1 I think the answer is yes.
These are horribly unreadable choices for the parameter names. If you are here to learn, then my advice is to choose variable and parameter names that enhance, rather than obscure the readability of the code. Why not use request and response?

Please forgive me of my lack of knowledge. I am really trying to learn.
That's good, no apology necessary.
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
You have made my day. The suggestion to put the 'post' in my calling form worked. I just assumed(right) that the doPost and doGet methods were literal. I have not had any trouble up until now.

Thanks again for sharring your knowledge. I am sure I will have a lot more issues to question you about.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

Be sure that you understand why that worked!
Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
Did you really name your request parameter arg0?


Some IDEs use this name when you use a wizard to create a new Servlet. You will probably say that you should then change this name and I agree. I just wanted to point out that sometimes it is not a conscious choice.
goli reddy
Greenhorn

Joined: Sep 02, 2007
Posts: 8
is it your request is get/post it is being limitaions on length.i think get is limited 240 to 250 characters
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61772
    
  67

The URL limit is browser dependent.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does getParameterValues have a Limit