Salve,
avrei la necessita di avere una pagina jsp (anche di altro tipo, da inserire in server ubuntu) con più pulsanti ogniuno dei quali attiva un comando unix diverso.
il seguente codice ha il difetto di attivare tutti i comandi quando clicco un pulsante. Che correzione devo fare? c'è qualcuno che mi può aiutare?
<%@ page language="java" contentType="text/html; charset=US-ASCII"
pageEncoding="US-ASCII"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>First JSP</title>
<%
%>
</head>
<%@ page import="java.util.*,java.io.*"%>
<body>
<FORM NAME="form1" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="buttonName">
<INPUT TYPE="BUTTON" VALUE="caric 1" ONCLICK="button1()">
</FORM>
<BR><BR>
<script>
function button1(){
<%
String unixCommand = "/opt/pentaho/data-integration/kitchen.sh -file /opt/pentaho/etl/invio_1.kjb ";
Runtime rt = Runtime.getRuntime();
try {
rt.exec(unixCommand);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
%>
alert("Caricamento 1 attivato");
}
</script>
<FORM NAME="form2" METHOD="POST">
<INPUT TYPE="BUTTON" VALUE="Caric 2" ONCLICK="button2()">
</FORM>
<script>
function button2(){
<%
String unixCommand2 = "/opt/pentaho/data-integration/kitchen.sh -file /opt/pentaho/etl/invio_2.kjb ";
Runtime rt2 = Runtime.getRuntime();
try {
rt2.exec(unixCommand2);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
%>
alert("Caricamento 2 attivato");
}
</script>
<div contenteditable="true">
</div>
</body>
</html>
grazie in anticipo
Ettore