jsp call shell or linux command
来源:互联网 发布:手机怎么进淘宝社区 编辑:程序博客网 时间:2024/05/22 13:00
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.io.*,java.lang.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
This is my JSP page. <br>
<a href="/ftp/ftp/ftpgetlog.sh">下载</a><br/>
<%
Process p=null;
BufferedReader br =null;
BufferedReader ebr =null;
String line=null;
String eline=null;
StringBuffer sBuffer=null;
StringBuffer esBuffer=null;
try{
String fpath=request.getContextPath()+File.separator+"ftp"+File.separator;
String pathShell=fpath+"unself_account.sh";
String newPath="/home/was/jxkh_prj/bin/unself_account.sh";
p=Runtime.getRuntime().exec(new String[]{"/bin/sh","-c",newPath,"20140828","8881011200004433"});%>
pathShell==<%=pathShell%><br/>
process==<%=p%><br/>
waitFor==<%=p.waitFor()%><br/>
exitValue==<%=p.exitValue()%><br/>
InputStream==<%=p.getInputStream()%><br/>
ErrorStream==<%=p.getErrorStream()%><br/>
<%br = new LineNumberReader(new InputStreamReader(p.getInputStream()));
ebr = new LineNumberReader(new InputStreamReader(p.getErrorStream()));
esBuffer= new StringBuffer();
sBuffer= new StringBuffer();
while((eline=ebr.readLine())!=null){
esBuffer.append(eline);
}
while((line=br.readLine())!=null){
%>
line==<%=line%><br/>
<%sBuffer.append(line);
}%>
sBuffer==<%=sBuffer.toString()%><br/>
esBuffer==<%=esBuffer.toString()%><br/>
<%
}catch(IOException e){
throw e;
}finally{
if(null!=br){
br.close();
}
if(null!=ebr){
ebr.close();
}
}
%>
</body>
</html>
<%@ page language="java" import="java.io.*,java.lang.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
This is my JSP page. <br>
<a href="/ftp/ftp/ftpgetlog.sh">下载</a><br/>
<%
Process p=null;
BufferedReader br =null;
BufferedReader ebr =null;
String line=null;
String eline=null;
StringBuffer sBuffer=null;
StringBuffer esBuffer=null;
try{
String fpath=request.getContextPath()+File.separator+"ftp"+File.separator;
String pathShell=fpath+"unself_account.sh";
String newPath="/home/was/jxkh_prj/bin/unself_account.sh";
p=Runtime.getRuntime().exec(new String[]{"/bin/sh","-c",newPath,"20140828","8881011200004433"});%>
pathShell==<%=pathShell%><br/>
process==<%=p%><br/>
waitFor==<%=p.waitFor()%><br/>
exitValue==<%=p.exitValue()%><br/>
InputStream==<%=p.getInputStream()%><br/>
ErrorStream==<%=p.getErrorStream()%><br/>
<%br = new LineNumberReader(new InputStreamReader(p.getInputStream()));
ebr = new LineNumberReader(new InputStreamReader(p.getErrorStream()));
esBuffer= new StringBuffer();
sBuffer= new StringBuffer();
while((eline=ebr.readLine())!=null){
esBuffer.append(eline);
}
while((line=br.readLine())!=null){
%>
line==<%=line%><br/>
<%sBuffer.append(line);
}%>
sBuffer==<%=sBuffer.toString()%><br/>
esBuffer==<%=esBuffer.toString()%><br/>
<%
}catch(IOException e){
throw e;
}finally{
if(null!=br){
br.close();
}
if(null!=ebr){
ebr.close();
}
}
%>
</body>
</html>
0 0
- jsp call shell or linux command
- Tcl call Awk and shell command-exec
- linux shell command usage
- Linux Shell Sed command
- linux shell command
- Linux shell command
- linux --- shell command
- Linux - test command or [ expr ]
- Linux shell function call Sample
- Linux shell : Command 2>&1
- IT-linux-shell-command--usleep
- Linux--shell of "tr" command
- jsp 调用linux shell
- Linux Command Line and Shell Scripting Bible
- Most Basic Shell Command for Linux(Ubuntu)
- Python(4) 调用linux shell command
- UNIX and Linux Shell Script Test Command
- 0530 linux系统command shell(1)
- easyui combogrid 本地模糊搜索过滤多列
- 【java】DOS控制台常用命令
- Web自动化测试原理
- 苹果开发者查看账号到期时间及续费网址
- 机房收费系统总结
- jsp call shell or linux command
- 自学安卓开发基础总结1_关于安卓
- Android中AsyncTask的简单用法
- web项目开发 之 前端规范 --- JavaScript编码规范
- SGU 201 Non Absorbing DFA
- 彻底理解android中的内部存储与外部存储
- dubbo zookeeper
- 蓝牙之四-Handler
- Java开源框架集