*
The moose likes JSP and the fly likes How to pass filename+contens as hidden fields to servlet from jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to pass filename+contens as hidden fields to servlet from jsp" Watch "How to pass filename+contens as hidden fields to servlet from jsp" New topic
Author

How to pass filename+contens as hidden fields to servlet from jsp

Ravi Kumar
Greenhorn

Joined: Aug 28, 2008
Posts: 18
Hi,

I have declared the browse file declaration as below

<form name frm2>
<input class="BrowseFile" name="filename" onchange="addAttachment();" onkeypress="return uploadAttachmentOnEnter()" type="file">
</form>

Now i want to pass this "filename" as hidden to servlet from jsp with contents. I have declared a hidden variable in jsp and try to assign the "filename" to that variable it is passing only filename but not contents available inside the file.

Please suggest me how to pass the filename+contents to servlet from jsp.

Thanks
Ravi Kumar. A
Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
You could use

However, there are restrictions. You will only get a hold of the filename, not the filepath. This is somewhat in terms of confidentiality. I wouldn't want everybody to know about my directory structure.


JDBCSupport - An easy to use, light-weight JDBC framework -
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60785
    
  65

See the JSP FAQ.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Consider Paul's rocket mass heater.
 
subject: How to pass filename+contens as hidden fields to servlet from jsp
 
Similar Threads
Shopping cart help
Passing values between two JSPs
sendRedirect fails to post data along with url if the data is too large
Reading parameter from JSP page
Best Way to Encode Response Parameter