Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Not Reading Request Parameters

 
Steve Dyke
Ranch Hand
Posts: 1718
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are starting to deploy virtual desktops in our factory.

I have a file upload form that works on conventional desktops but fails on the virtual machines.

Notice the lifecycle parameter is not being passed to servlet on these virtual machines but does get passed when ran from standard desktop machine.

this is my form code



this is the servlet error:

AttachmentListController: userName: STEVE DYKE File Attachment Source: SI
AttachmentListController: userName: STEVE DYKE e: java.lang.NullPointerException
AttachmentListController: Parameter List: doctype
AttachmentListController: Parameter List: docindexno
AttachmentListController: Parameter List: fileName
AttachmentListController: Parameter List: fileuploadformsource
AttachmentListController: Parameter Name: doctype
AttachmentListController: Parameter Value: Certs
AttachmentListController: Parameter Name: docindexno
AttachmentListController: Parameter Value: 3895751
AttachmentListController: Parameter Name: fileName
AttachmentListController: Parameter Value: D:\Users\thn\Desktop\marysailer.pdf
AttachmentListController: Parameter Name: fileuploadformsource
AttachmentListController: Parameter Value: SI
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The servlet getParameter() family of methods do not work with multipart requests. You must use the API of whatever library you are using to handle the uploads.
 
Stefan Evans
Bartender
Posts: 1822
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mixing URL/GET parameters with POST parameters can be troublesome.
My recommendation would be to remove the lifecycle parameter from the url, and put it in an input type="hidden" so that you pass all the parameters via one method.

With regards to the error, it looks like you are logging and swallowing a null pointer exception. What is null?
The code you have posted looks ok. What about the code creating/logging this output?
 
Steve Dyke
Ranch Hand
Posts: 1718
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:The servlet getParameter() family of methods do not work with multipart requests. You must use the API of whatever library you are using to handle the uploads.


Can you explain why this works on every computer(for two years now) but the virtual desktops?

Would you suggest using another method to upload files?
 
Dave Tolls
Ranch Hand
Posts: 2291
25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you got the code that throws that error?
 
Steve Dyke
Ranch Hand
Posts: 1718
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Evans wrote:Mixing URL/GET parameters with POST parameters can be troublesome.
My recommendation would be to remove the lifecycle parameter from the url, and put it in an input type="hidden" so that you pass all the parameters via one method.

With regards to the error, it looks like you are logging and swallowing a null pointer exception. What is null?
The code you have posted looks ok. What about the code creating/logging this output?


It is the lifecycle parameter that is causing the NullPointerException.
 
Steve Dyke
Ranch Hand
Posts: 1718
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Evans wrote:Mixing URL/GET parameters with POST parameters can be troublesome.
My recommendation would be to remove the lifecycle parameter from the url, and put it in an input type="hidden" so that you pass all the parameters via one method.

With regards to the error, it looks like you are logging and swallowing a null pointer exception. What is null?
The code you have posted looks ok. What about the code creating/logging this output?


So if I left the lifecycle parameter like it is because it works in most cases and added a new form field and added the following code to my servlet would this work?

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!