• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multipart request in a single form

 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have to perform 2 actions on the same the same jsp page and the control needs to come to the the same page.

One is of uploading an image and other is of deleting the image. I am able to upload the image and successfully delete also.

but in case of delete the control is not coming back to the same page.Error is of page not found. It is because of the multipart request I am using for uploading the file. Both actions are in the same form.


I have tried forwarding the request, instead of submitting the form, it is also not working.

It will be a great help if, some inputs could be provided.

Regards,
Neeraj.
[ November 18, 2005: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fact that you are using multipart forms should have no effect on forwarding or redirecting.
Can you post your code?
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have set a session variable which checks the status of the action(delete/upload). if it is delete I am forwarding the request.

On jsp page request object is not working( my guess because of multipart request). will try to post code... I am posting messages from a cafe..(we are not allowd net access from office

regards,
neeraj/
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When using multipart request, the ServletRequest.getParameter methods won't work. They will return null.
Read the documentation that came with whatever upload library you're using.
Each of them provides a way to retrieve normal form fields.



I am posting messages from a cafe..(we are not allowd net access from office)

 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the inputs Ben. I was using orielly's multipart utility. That issue has been resolved now.. On delete action I changed the enctype from multipart to default. and it worked for me.

Regards,
Neeraj.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Neeraj Vij:
Thanks for the inputs Ben. I was using orielly's multipart utility. That issue has been resolved now.. On delete action I changed the enctype from multipart to default. and it worked for me.


Glad its working now. But the better way would be to get the normal field from your multipart-form enctype. As Ben said, there must be some way to get that using any file-upload library. Check out the library docs you are using.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!