html代码:
<form action="192.168.1.253:10003" method="get">
<table border="1" cellpadding="10" cellspacing="0">
<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="psw"/>
</td>
</tr>
<tr>
<td>确认密码:</td>
<td>
<input type="password" name="repsw"/>
</td>
</tr>
<tr>
<td>选择性别:</td>
<td>
男:<input type="radio" name="sex" value="male"/>
女:<input type="radio" name="sex" value ="female" checked="checked"/>
</td>
</tr>
<tr>
<td>选择技术:</td>
<td>
<input type="checkbox" name="teach" value="java"/>Java
<input type="checkbox" name="teach" value="html"/>Html
<input type="checkbox" name="teach" value="css"/>Css
</td>
</tr>
<tr>
<td>选择国家:</td>
<td>
<select name="country">
<option value="none" selected="selected">--选择国家--</option>
<option value="CH">中国</option>
<option value="USA">USA</option>
<option value="GER">德国</option>
</select>
</td>
</tr>
<tr>
<th>
<input type="submit" value="提交数据"/>
</th>
<th>
<input type="reset" value="重置数据"/>
</th>
</tr>
</table>
</form>
java服务器端代码
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class RegServer {
public static void main(String[] args) throws IOException {
ServerSocket ss = new ServerSocket(10003);
Socket s = ss.accept();
System.out.println(s.getInetAddress().getHostAddress()+"...connected");
InputStream in = s.getInputStream();
byte[] buf = new byte[1024];
int len = in.read(buf);
String str = new String(buf,0,len);
System.out.println(str);
PrintWriter out =new PrintWriter(s.getOutputStream(),true);
out.println("<font color='green' size=7>注册成功</font>");
s.close();
ss.close();
}
}