• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Upload JSP

 
Rohit Malhotra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have written a JSP for File Upload which has a form element
<"FORM ENCTYPE="multipart/form-data">
<input type="submit" name="option" value="upload">
<input type="submit" name="option" value="check-in">
</form>
the problem is now. i want to check which button is clicked. by request.getPArameter("option"); however. it does not return any value since the enctp is mulipart/form. Can anyone please let me know how can i check which button is clickd?
Reggards,
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you parsing the multi-part request? With your own code, or a 3rd-party package?
 
Rohit Malhotra
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a third party tool typically FileUpload jar from apache.
 
Stefan Evans
Bartender
Posts: 1780
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fileUpload component has a guide here that demonstrates how to retrieve the standard request parameters.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The documentation of your upload package should tell you how to obtain the non-file parameters. If your package doesn't let you do that, try a different one.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by srilatha reddy:
onclick event of button write code to set the value in request/session object


And how exactly do you propose he do that?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by srilatha reddy:
within jsp scriplet write
request.setAttribute("todo","upload");

in onclick event



That would be pointless. The onclick event is fired on the client as a Javscript event. Any scriptlet "embedded" in it would have been executed on the server before the page was even sent to the browser.
[ March 01, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic