本帖最后由 微笑=.一瞬间 于 2014-5-19 18:07 编辑
客户端
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form action="http://localhost:10000">
<fieldset>
<legend>注册区域</legend>
<table border="1" bordercolor="#0066FF" cellspacing="0" width="70%" cellpadding="10">
<tr>
<th colspan="2">信息注册页面</th>
</tr>
<tr>
<td>
用户名
</td>
<td>
<input type="text" name="user" />
</td>
</tr>
<tr>
<td>密码
</td>
<td>
<input type="password" name="pasw" />
</td>
</tr>
<tr>
<td> 确认密码
</td>
<td>
<input type="password" name="repasw" />
</td>
</tr>
<tr>
<td>
性别
</td>
<td>
<input type="radio" name="sex" value="man" />男
<input type="radio" name="sex" value="women" />女
</td>
</tr>
<tr>
<td>
技术
</td>
<td>
<input type="checkbox" name="JS" value="java" />java
<input type="checkbox" name="JS" value="html" />html
</td>
</tr>
<tr>
<td>
国家
</td>
<td>
<select name="country">
<option value="none">--选择国家--</option>
<option value="cn">中国</option>
<option value="usa">美国</option>
<option value="en">英国</option>
</select>
</td>
</tr>
<tr>
<th colspan="2">
<input type="submit" value="提交" />
<input type="reset" value="重置" />
</th>
</tr>
</table>
</fieldset>
</form>
</body>
</html>
服务端:
import java.net.*;
import java.io.*;
class MyServerSocket
{
public static void main(String[] args) throws Exception
{
ServerSocket ss=new ServerSocket(10000);
Socket s=ss.accept();
String ad=s.getLocalAddress().getHostAddress();
System.out.println(ad);
OutputStream out=s.getOutputStream();
PrintWriter pw=new PrintWriter(out,true);
pw.println("<font size=7 color=red>Success</font>");
ss.close();
s.close();
}
}
运行没问题但为什么客户端浏览器没解析<font size=7 color=red>Success</font>这句话呢?
运行截图如下:
|
|