javaee servlet简单操作
input.html <from action="login" method="post"> user:<input type="txet" name="name" /> adim:<input type="password" name="name"/> <type="submit" vlaue="提交"> </form> Login.java public calss Login extends HttpServlet{ public void doPost(HtppServletRequest rest,HttpServletResponse resp ) throws ServletException,IOException{ rest.setcharacterEncoding("utf-8"); String name= rest.getparameter("name"); String password= rest.getparameter("password"); rest.setAttribute("name",name); rest.setAttribute("password",passwoed); rest.getRequestDispatcher("output.jsp").forward(rest,resp); } } wed.xml <servlet> <servlet-name>lg</servlet-name> <servlet-class>Login</servlet-class> </servlet> <servlet-mapping> <servlet-name>ls<servlt-name> <url-pattern>/login<url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp<welcome-file> </welcome-file-list> output.jsp user:${name}; passwoed:${password} input.html <from action="login" method="post"/> <input type="txet" name="name" /> <input type="passwrod" name="passwrod"/> <input type="submit"/> </form> Login.java pulib class Login extends HttpSverlet{ pulib void doPost(HttpSverletRequest requst ,HttpSverletResponse rese){ requst.setcharacterEncoding } }