• Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp/java bean file saver not working  RSS feed

 
Lavanya Halliwell
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page that displays a table from a database query. If the file chooser box isn't null, then on the click of the save button it should pass the file path to my java bean and write the file....

this works on my local sun java app server, but not on the real sun java app server. (for what it's worth I have a delete button that works in a similar way, and it does work on the server)


basic flow: (click this save button)



call this java script function:




after submit, page reloads and looks for this action....




set results to display and possible call save function...





Java bean:



thanks for any tips here!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read ⇒ UseCodeTags ⇐ and edit your post accordingly.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. When using BB tags, it's best not to disable them.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you are uploading a file from the client to the server?

If so, what upload package are you using? and have you checked the FAQ which has an entry on file uploading?
 
Lavanya Halliwell
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am trying to get a filename on the client side for a java bean method to write to.

for example I select that test.txt on the desktop...

then the server side takes the filename and passes that to a java bean where I have a function that writes data to it...

basically what I try to do is overwrite that file that the user selected...

how do you create a new file with the user's filename on the their machine? (as it's a save option I probably shouldn't be overwriting, but creating a new one)

thanks



ps - sorry about the forum code post mess, ill have to not disable the tags, thanks for fixing that!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lavanya Halliwell wrote:for example I select that test.txt on the desktop...

then the server side takes the filename and passes that to a java bean where I have a function that writes data to it...

Well, that cannot possibly work. Think about it for a minute...

You are selecting a file on the client system, and trying to write to it on the server. Of course that's only going to work when the client and the server are the same machine.

You cannot write to the client file system at all from a web application. If that's what your aim is, you're going to have to re-think your approach.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does?!
 
Lavanya Halliwell
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry about that last part, your right it's just a counter and I should have been more specific about what that was...
I just wasn't as important to my question. I should have said that I am using that to keep track of the number of rows...

and you're right about writing that to the client, i will have to see if there is a place I can make like a drop box for files I create with my database query info.

thanks for your input!
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lavanya Halliwell wrote:I should have said that I am using that to keep track of the number of rows

It works?!
 
Lavanya Halliwell
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so in the flow of the program, on "submit" I capture if I want to go next 5 or prev 5....

the following is how I use that to select the 5 records in the (possibly) massive result set that I want to display....




not part of my original question, but thought i'd clarify....
 
Lavanya Halliwell
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to put some closure on the "real" question that I originally posted....


yes, thanks for pointing out the obvious case that you can't "save" a file to the client computer!


I had database results printed on the screen, like i've explained in the previous post, displaying in groups of 5.
I made a save button which really just does an "Export to excel", but allows the user to capture all the results if they want to.


way easier then I was making it! (as is the case when I am learning how to do stuff)
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My point was only that current += (skip-skip); couldn't possibly be used to keep track of anything, as current's values wouldn't change.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!