Exercises for Java Server Pages (JSP)

Fill in the blanks:

  1. The encoding mechanism used for Chinese characters in JSP files is   ISO8859-1             .
  2. The default port of Tomcat server is      8080          .
  3. Using JSP to establish a connection with a DBMS can be divided into two steps:         loading the driver           and        establishing a connection          .
  4. Among the JSP built-in objects, the object related to the request is          Request                    .
  5. There are usually two ways for the client to submit data to the server: one is       the Get       submission method; the other is the Post submission method.
  6. JSP files are eventually converted into              servlet (or bytecode)                           files.
  7. The method used in the Out object to output various types of data and wrap new lines is         the println() method                .
  8. In JSP, when a query operation is performed, the query results are generally saved in       the ResultSet         object.
  9. For exception handling, three types of code can be included in the code segment of the method:       try          and         catch     

and            finally           code block.

  1. In the JSP specification, two formats of comments can be used: one is          output comments             ; the other is         hidden comments              .
  2.       The DatabaseMetaData             interface is mainly used to obtain information about the database, while        the ResultMetaData             class is used to obtain the structure of the database table.
  3. The full English name of JSP is             Java Server Page                             .
  4. 11. In JSP, you can use         the <jsp:SetProperty>                       operation to set the properties of the Bean, and you can also use the <jsp:GetProperty> operation to get the value of the Bean.

short answer questions

  1. Briefly describe the establishment of JSP development environment
  1. Download and install JDK
  2. Configure environment variables.
  3. Download and install TomCat.
  4. To create a WEB application in the TomCat server, the steps are as follows:
  1. Enter the webapps directory of TomCat's installation directory, and you can see Tomcat's own directories such as ROOT, examples, and tomcat-docs;
  2. Create a new directory under the webapps directory and name it myapp;
  3. Create a new directory WEB_INF under myapp. Note that the directory name is case-sensitive;
  4. Create a new web.xml under WEB-INF; the content in web.xml can be copied from the corresponding file in the Root directory.
  5. Write a JSP file first.jsp.
  6. Copy the file to the myapp folder;
  7. Start TomCat.
  8. Enter http://127.0.0.1:80808/myapp/first.jsp in the browser to run the program.

  1. Which files need to be configured in to configure the Servlet filter, and what tags need to be configured?

Programming questions:

P147 Example 8-6

2. Write a JSP page to calculate the area of ​​the triangle, enter the three sides of the triangle, and click the "Submit" button to get the area.

Guess you like

Origin blog.csdn.net/m0_63715487/article/details/133085461