<%@ page language="java" import="java.util.*,java.io.*" pageEncoding="utf-8"%>
<%
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 'upload.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>
<jsp:useBean id="smart" scope="page" class="org.lxh.smart.SmartUpload"/>
<%
// 1、上传初始化
smart.initialize(pageContext) ;
// 2、准备上传
smart.upload() ;
// 3、保存上传的文件
smart.save("/upload");
System.out.println("=================");
%>
<%
String jobname = smart.getRequest().getParameter("jobname") ;
String jobpath = smart.getRequest().getParameter("jobpath") ;
String cpunum = smart.getRequest().getParameter("cpunum") ;
String joboutput = smart.getRequest().getParameter("joboutput") ;
String jobstring = smart.getRequest().getParameter("jobstring") ;
%>
<table>
<tr>
<td>
恭喜你,上传成功!
</td>
</tr>
<tr>
<td>
上传任务为:<%=jobname %>
</td>
</tr>
<tr>
<td>
任务路劲为:<%=jobpath %>
</td>
</tr>
<tr>
<td>
任务所需CPU数目为:<%=cpunum %>
</td>
</tr>
<tr>
<td>
输出目录:<%=joboutput %>
</td>
</tr>
<tr>
<td>
测试的字符串为:<%=jobstring %>
</td>
</tr>
<tr>
<td>
<A href="/Grid_Web/hpc/shu02/jobrun.jsp">运行任务</A>
</td>
</tr>
</table>
<%
try{
File file = new File("E:\\job.xml");
FileWriter outfile = new FileWriter(file);
// String line1="<?"+"xml version="+"\""+"1.0"+"\""+" "+"encoding="+"\""+"UTF-8"+"\""+"?>";
// String line2="<"+"rsl:rsl xmlns:rsl="+"\""+"http://www.globus.org/namespaces/2004/02/rsl"+"\"" +" "+
// "xmlns:enum="+"\""+"http://www.globus.org/namespaces/2004/02/rsl/enum"+"\"" +" "+
"xmlns:gram="+"\""+"http://www.globus.org/namespaces/2004/02/rsl/gram"+"\"" +" "+
// "xmlns:xsi="+"\""+"http://www.w3.org/2001/XMLSchema-instance"+"\"" +" ";
// String line7= "xsi:schemaLocation="+"\""+"http://www.globus.org/namespaces/2004/02/rsl";
// String line8= "/usr/local/gt3/schema/base/gram/rsl.xsd";
/// String line9= "http://www.globus.org/namespaces/2004/02/rsl/gram";
/// String line10= "/usr/local/gt3/schema/base/gram/gram_rsl.xsd"+"\""+">";
FileReader fr ;
fr = new FileReader("e:\\head.txt");
BufferedReader br = new BufferedReader(fr);
String tmp;
String line3="<"+"gram:job"+">" +
"<"+"gram:executable"+"> <"+"rsl:path"+">" +
"<"+"rsl:stringElement value="+ "\""+jobpath+"\"" +"/> </"+"rsl:path"+">" +
"</"+"gram:executable"+">";
String line4="<"+"gram:arguments"+">" +
"<"+"rsl:stringArray"+">" +
"<"+"rsl:string"+"> <"+"rsl:stringElement value="+ "\""+jobstring+"\"" +"/> </"+"rsl:string"+">" +
"</"+"rsl:stringArray"+">" +
"</"+"gram:arguments"+">";
String line5="<"+"gram:stdout"+">" +
"<"+"rsl:pathArray"+">" +
"<"+"rsl:path"+">" +
"<"+"rsl:substitutionRef name="+"\""+"HOME"+"\""+"/>" +
"<"+"rsl:stringElement value="+ "\""+joboutput+"\"" +"/>" +
"</"+"rsl:path"+">" +
"</"+"rsl:pathArray"+">" +
"</"+"gram:stdout"+">";
String line6="<"+"gram:count"+"> <"+"rsl:integer value="+"\""+"1"+"\""+"/></"+"gram:count"+">" +
"</"+"gram:job"+">" +
"</"+"rsl:rsl"+">";
while((tmp=br.readLine())!=null){
outfile.write(tmp);
}
// outfile.write(line1+"\n");
// outfile.write(line2+"\n");
// outfile.write(line7+"\n");
// outfile.write(line8+"\n");
// outfile.write(line9+"\n");
// outfile.write(line10+"\n");
outfile.write(line3+"\n");
outfile.write(line4+"\n");
outfile.write(line5+"\n");
outfile.write(line6+"\n");
%>
<%
outfile.close();
%>
<%
}
catch (java.io.IOException e){
System.err.println ("IOException " + e.getMessage());
}
%>
</body>
</html>
<%
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 'upload.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>
<jsp:useBean id="smart" scope="page" class="org.lxh.smart.SmartUpload"/>
<%
// 1、上传初始化
smart.initialize(pageContext) ;
// 2、准备上传
smart.upload() ;
// 3、保存上传的文件
smart.save("/upload");
System.out.println("=================");
%>
<%
String jobname = smart.getRequest().getParameter("jobname") ;
String jobpath = smart.getRequest().getParameter("jobpath") ;
String cpunum = smart.getRequest().getParameter("cpunum") ;
String joboutput = smart.getRequest().getParameter("joboutput") ;
String jobstring = smart.getRequest().getParameter("jobstring") ;
%>
<table>
<tr>
<td>
恭喜你,上传成功!
</td>
</tr>
<tr>
<td>
上传任务为:<%=jobname %>
</td>
</tr>
<tr>
<td>
任务路劲为:<%=jobpath %>
</td>
</tr>
<tr>
<td>
任务所需CPU数目为:<%=cpunum %>
</td>
</tr>
<tr>
<td>
输出目录:<%=joboutput %>
</td>
</tr>
<tr>
<td>
测试的字符串为:<%=jobstring %>
</td>
</tr>
<tr>
<td>
<A href="/Grid_Web/hpc/shu02/jobrun.jsp">运行任务</A>
</td>
</tr>
</table>
<%
try{
File file = new File("E:\\job.xml");
FileWriter outfile = new FileWriter(file);
// String line1="<?"+"xml version="+"\""+"1.0"+"\""+" "+"encoding="+"\""+"UTF-8"+"\""+"?>";
// String line2="<"+"rsl:rsl xmlns:rsl="+"\""+"http://www.globus.org/namespaces/2004/02/rsl"+"\"" +" "+
// "xmlns:enum="+"\""+"http://www.globus.org/namespaces/2004/02/rsl/enum"+"\"" +" "+
"xmlns:gram="+"\""+"http://www.globus.org/namespaces/2004/02/rsl/gram"+"\"" +" "+
// "xmlns:xsi="+"\""+"http://www.w3.org/2001/XMLSchema-instance"+"\"" +" ";
// String line7= "xsi:schemaLocation="+"\""+"http://www.globus.org/namespaces/2004/02/rsl";
// String line8= "/usr/local/gt3/schema/base/gram/rsl.xsd";
/// String line9= "http://www.globus.org/namespaces/2004/02/rsl/gram";
/// String line10= "/usr/local/gt3/schema/base/gram/gram_rsl.xsd"+"\""+">";
FileReader fr ;
fr = new FileReader("e:\\head.txt");
BufferedReader br = new BufferedReader(fr);
String tmp;
String line3="<"+"gram:job"+">" +
"<"+"gram:executable"+"> <"+"rsl:path"+">" +
"<"+"rsl:stringElement value="+ "\""+jobpath+"\"" +"/> </"+"rsl:path"+">" +
"</"+"gram:executable"+">";
String line4="<"+"gram:arguments"+">" +
"<"+"rsl:stringArray"+">" +
"<"+"rsl:string"+"> <"+"rsl:stringElement value="+ "\""+jobstring+"\"" +"/> </"+"rsl:string"+">" +
"</"+"rsl:stringArray"+">" +
"</"+"gram:arguments"+">";
String line5="<"+"gram:stdout"+">" +
"<"+"rsl:pathArray"+">" +
"<"+"rsl:path"+">" +
"<"+"rsl:substitutionRef name="+"\""+"HOME"+"\""+"/>" +
"<"+"rsl:stringElement value="+ "\""+joboutput+"\"" +"/>" +
"</"+"rsl:path"+">" +
"</"+"rsl:pathArray"+">" +
"</"+"gram:stdout"+">";
String line6="<"+"gram:count"+"> <"+"rsl:integer value="+"\""+"1"+"\""+"/></"+"gram:count"+">" +
"</"+"gram:job"+">" +
"</"+"rsl:rsl"+">";
while((tmp=br.readLine())!=null){
outfile.write(tmp);
}
// outfile.write(line1+"\n");
// outfile.write(line2+"\n");
// outfile.write(line7+"\n");
// outfile.write(line8+"\n");
// outfile.write(line9+"\n");
// outfile.write(line10+"\n");
outfile.write(line3+"\n");
outfile.write(line4+"\n");
outfile.write(line5+"\n");
outfile.write(line6+"\n");
%>
<%
outfile.close();
%>
<%
}
catch (java.io.IOException e){
System.err.println ("IOException " + e.getMessage());
}
%>
</body>
</html>