aspose file tools*
The moose likes JSP and the fly likes File Upload JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "File Upload JSP" Watch "File Upload JSP" New topic
Author

File Upload JSP

Rohit Malhotra
Greenhorn

Joined: Jan 29, 2006
Posts: 21
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

Joined: Jan 10, 2002
Posts: 61216
    
  66

How are you parsing the multi-part request? With your own code, or a 3rd-party package?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rohit Malhotra
Greenhorn

Joined: Jan 29, 2006
Posts: 21
I am using a third party tool typically FileUpload jar from apache.
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
The fileUpload component has a guide here that demonstrates how to retrieve the standard request parameters.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61216
    
  66

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

Joined: Jan 10, 2002
Posts: 61216
    
  66

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

Joined: Jan 10, 2002
Posts: 61216
    
  66

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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File Upload JSP