SoFunction
Updated on 2025-03-02

Simple understanding and application of methods

A brief explanation

(1) () Obtaining is to obtain data passed in through the implementation of the container through the implementation of the container. () and getAttribute () are only flowing inside the web container, and are only in the request processing stage.

(2) The data passed by the () method will be transmitted from the web client to the web server, representing HTTP request data.

Give an example

<form action="xxx" >

<input name="name" value="hello word"/>
<input type="submit" value="submit"/>

</form>

After submitting the request, in your action

String name = ("name");

Then the value of name is "hello word"

Reading and encapsulating the data in the jsp file can be simply understood as a method of taking parameters.

   <body>
       <form action="${ }/" name="frmLogin"  method="post">
          username: <input type="text" name="name"> <br/>
        password: <input type="text" name="pwd"> <br/>
          <input type="submit" value="Login"> <br/>
       </form>
  </body>
</html>

It takes out the content of jsp and then encapsulates it into the setName method of the User implementation class for further encapsulation.

The request data is obtained here and encapsulated.

        String name = ("name");
        String pwd = ("pwd");
        User user = new User();
        (name);
        (pwd);

Summarize

The above is the learning record and understanding of the () method when learning Javaweb. I hope it can give you a reference and I hope you can support me more.