request.getParameter understand

For request.getParameter httprequrest's () role,

   Substantially as follows:

<form Action = "xxxxxxx.do">
<the INPUT name = "name" value = "ha ha" />
<the INPUT of the type = "the Submit" value = "submit" />
</ form>
after this form to submit a request, you the action in
String name = request.getparameter ( "name"  );
then the value is the name of "ha"
   it is a method to take parameters. Jsp to read the data file to it. Then it can be encapsulated utilized.


Look here:

   <body>
       <form action="${pageContext.request.contextPath }/login.action" name="frmLogin"  method="post">
          用户名: <input type="text" name="name"> <br/>
        密码: <input type="text" name="pwd"> <br/>
          <input type="submit" value="登陆"> <br/>
       </form>
  </body>
</html>

   Jsp content out of it, and then encapsulated into setName method implemented User class is further encapsulated.
    1 // data acquisition request, encapsulating
        String name = request.getParameter ( "name");
        String pwd = request.getParameter ( "pwd");
        the User User new new = the User ();
        user.setName (name);
        User. setPwd (pwd);

 

Guess you like

Origin www.cnblogs.com/mmfang/p/12569370.html