Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using .jsp to execute .sh script

Status
Not open for further replies.

TimeTraveler

IS-IT--Management
Nov 20, 2001
99
US
I have a non-interactive, quiet (no stdout/stderr) server-side program I need to run off a link on a .jsp page. My .jsp code is below.

Code:
<HTML>
<HEAD>
<% String title = "Foo Test"; %>
<% String foo = "./foo.sh"; %>
<TITLE><%= title %></TITLE>
<!-- filename: foo.jsp -->
</HEAD>
<BODY>
<H2><%= title %></H2>
<P>This page is testing how to trigger a UNIX script from a .jsp page.</P>
<P><A HREF="<%= foo %>" target="bar"><%= foo %></A></P>
</BODY>
</HTML>

I've tried specifying the .sh file as both .sh and .cgi, but either way it just exposes code in the browser window, showing bits of HTML where it shows up in vars and here-docs. So, it's obvious Tomcat or Weblogic or whatever doesn't provide for CGI. I normally do only CGI programming, and near-zero object-oriented coding. I've seen pages describing how to use Runtime.exec(), but only in a .java file, which I know nothing about and the number of lines of code for something like GoodExec or whatever is beyond me.

If this were a CGI project, I'd be done in a couple minutes, but this .jsp/.java stuff takes soooooo long to do, and there's always a gotcha.

Thanks in advance for any help.

Sean aka Time Traveler


[rockband]
 
There is actually a forum specifically for JSPs and Servlets, forum695

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top