In this verse, we have a welcome. JSP page is modified to add a link to the page that calls the servlet to download the system log file that is logged in the previous section.
Creating Excelfileservlet with wizards
1. file->new...->web-> Double-click the standard servlet icon to start the wizard to create the standard servlet.
Specifies that the servlet class is named Excelfileservlet, sets the package name to Bookstore.servlet, and presses next to the next step.
2, choose the cover doget () processing method.
Figure 11 Overriding the Servlet method
· Servlet:creates content type:unspecified, set the type of the servlet's build document, as the servlet is downloaded as an Excel file and as an attachment, We need to manually set the response content type of the servlet.
implements Methods:doget (), so the wizard will generate a Doget () method framework.
Press next to the next step.
3, define the URL parameters for the servlet.
Figure 12 Defining the URL parameters for the servlet
Click Add parameter a new line appears in the parameter list, define the URL parameter for the servlet in the new row, where name is the name of the parameter with the URL, and variable is the corresponding variable name in the servlet. You can also specify comments and defaults for variables through desc and default, and specify the type of the variable in the Type column.
We have defined two URL parameters, year and month, which specify the years and months in which the log needs to be downloaded. Press next to the next step.