-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNewFile.jsp
56 lines (52 loc) · 1.42 KB
/
NewFile.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page contentType="text/html" import="java.io.*,java.net.*"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<div>
<h1>welcome</h1>
<%
Socket socket = null;
try{
try{
String msg;
socket = new Socket("10.100.38.227",1235);
System.out.println("Client connected at port::"+socket);
InputStreamReader IR = new InputStreamReader(socket.getInputStream());
BufferedReader BR = new BufferedReader(IR);
PrintStream PS = new PrintStream(socket.getOutputStream());
%>
<input type="text" name="textfield" id="textfield" value='<%=request.getParameter("textfield") %>'/>
<h1></h1>
<input type="submit" name="submit" id="submit" value="submit" onclick=""/>
<%
msg = request.getParameter("textfield");
PS.println(msg);
System.out.println("Client message::"+msg);
PS.flush();
%>
<%
String m = BR.readLine();
System.out.println("Received from server::"+m);
%>
<textarea rows="50" cols="50" disabled="disabled" name="textarea" id="textarea" >m</textarea>
<h1></h1>
<%
}
finally{
socket.close();
}
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</div>
</body>
</html>