Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invoke Windows/DOS commands from JSP?

 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am trying to invoke a Windows command (such as explorer.exe or cmd.exe) through a JSP that I have. I can't seem to get the JSP to recognize these commands through an <href> or any command. How does one accomplish this?

Specifically what I am try to do is invoke Windows explorer with a path such as C:\temp ..this path is passed to me as a variable in this JSP.

Any help/advice will be greatly appreciated. I have already attempted to search for this on this forum and haven't come up with any results.

Thanks much!
Veni
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the client or the server?

If on the client, completely impossible -- thank goodness.
 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

Thanks for the response. Ideally we wanted to open the folder on residing on a server from a client.

What if it were are shared folder with open access to all? What our project is trying to do, is allow users to open loan docs which are located in a shared-central location when they book loans...more for reference.

Do you think there is a way to do this?

Thanks
Veni
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just create links to the docs on the server? Why do you feel the need for DOS commands?
 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

We did that for another feature. But in this case, the number of docs may be huge 200+ and there are several such folders. So, rather than go through the maintenance of creating links to individual docs, we were hoping to give them access to the folder so that they can pick and choose what they want to view.

Any suggestions of work-arounds are most welcome.

Thanks
Veni
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ummm, you're using JSP, no? Auto-generate the links.
 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,

You are right, we can auto-generate links. But the file names are not standardized nor are the formats. So we have to potentially come up with a mechanism that does that.

In this particular case, since this app is completely internal, we were hoping that there may be a way to open a folder in Windows explorer from where the user can choose which file to view.

Thanks
Veni
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Veni Velkoor:
But the file names are not standardized nor are the formats. So we have to potentially come up with a mechanism that does that.


That's where I think your time would be best spent. With JSP, you're not going be able to give them Explorer-like access. The best you'll be able to do is to allow directory listings. But that, of course, opens up a bunch of security issues.

Perhaps a WEBDAV solution might be more appropriate.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic