小弟在家写一个隐藏表单!出现了些问题!还请各位大大帮忙解答一下!
代码如下!
main页面
package ch8;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Main extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=GBK ";
//Initialize global variables
public void init() throws
ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException,
IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println( " <html> ");
out.println( " <head> <title> Main </title> </head> ");
out.println( " <body bgcolor=\ "#ffffff\ "> ");
out.println( " <form action= 'regist ' method= 'post '> ");
out.println( "用户名: <input type= 'text ' name= 'username ' > <br/> ");
out.println( "密码: <input type= 'password ' name= 'password ' > <br/> ");
out.println( "年龄: <input type= 'text ' name= 'age ' > <br/> ");
out.println( "地址: <input type= 'text ' name= 'address ' > <br/> ");
out.println( "性别: <input type= 'radio ' name= 'sex ' value= '男 '> 男 <input type= 'radio ' name= 'sex ' value= '女 '> 女 <br/> ");
out.println( "爱好: <input type= 'checkbox ' name= 'like ' value= '电影 '> 看电影 ");
out.println( " <input type= 'checkbox ' name= 'like ' value= '音乐 '> 听音乐 ");
out.println(
"