• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

struts2: how to edit uploaded files

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have succeed to upload a few files using s:file tag, but how can i edit this page ? when i edit, s:file display nothing ,so if i submit ,the file field can just upload null. Do i need to choose files again even I don't want to change the file field ? thanks
[ October 20, 2008: Message edited by: yuxh yuxh ]
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..

Can you please first make your question clear.

because if you want to edit your uploaded file then it is not edit.

The only way to edit is open file write it and again upload it.

Image file not edit because it's binary format.

Thanks,
Nishan Patel.
 
luke yu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry for my poor English, you just misunderstood "edit". In my a.jsp :

it's fine to upload and submit this page(I store the files in a dir,and put their names in database). Then I want to edit this page, I just want to edit the "title1" field but the "photoAddress" field is blank now, how can I submit without affecting the "photoAddress" that has been stored.By the way ,i use array to deal with this two file .
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..

First of all if your tag like <s:file name ="photoAddress" />
same for both file tag.
Yes that's true if you use array for file then you have to specify index for edit.Here when you edit for file name photoAddress is same that's why it is blank each time of edit.


Thanks,
Nishan Patel.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a security measure, most browsers including Firefox, IE, and Safari all do not allow a server-side value to be defaulted in an <input type=file> tag. It is therefore not possible to set a default value using the s:file tag as it is eventually rendered as an <input type=file> tag.

Think about it. If this were allowed, it would be possible for a malicious site to default the value of the file to the location of your Outlook file containing all your addresses and confidential information and upload it using JavaScript before you were even aware of what was happening.

This link Explains it.
[ October 21, 2008: Message edited by: Merrill Higginson ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yuxh yuxh,

Please check your private messages for a message regarding an important administrative matter. You can do so by clicking My Private Messages in the upper right corner of the page.
 
luke yu
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,Nishan
thank you for your reply ,but I think there is something wrong with "blank" and Merrill had explained it. finally ,i use onclick and js to judge whether the file has been changed(of course,it's not perfect :)
thanks..by the way ,it's difficult to work out a name
[ October 21, 2008: Message edited by: yuxh yuxh ]
 
You got style baby! More than this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic