JSP integration test

Source: Internet
Author: User

.

Analysis: b/S architecture is not a substitute for C/s architecture, some programs such as large-scale network games are generally used in C/s architecture

.

Parsing: Files in the Web-inf directory cannot be accessed directly by the client. So the correct answer is C.

parsing:jsp is the scope of the JSP built-in object. Files and databases are persisted to preserve the data, so it is correct, and ServletContext is the context object of course. So the correct answer is a.

Analysis: This topic examines the JSP is the session of the solution. The second sentence of the code has been set to expire the session, so the third inning code is not correct. So the correct answer is a.

Parsing: usually using B

Parsing:request.getparameter ("userid") gets the value of the first FORM element name "UserID", and to get the values of multiple form elements with the same name, you need to pass request.getparametervalues ( "UserId") to get, returns an array of strings. So the answer is BC



Analytical:

The loginname final value of the form in index.jsp is bdqn when it arrives logindo.jsp then use forwarding mode to jump to loginsuccess.jsp, so request information is not lost use can get the parameter named LoginName value is BDQN

Parse: Use the page directive's properties ContentType: To tell the client browser to display the JSP file in text/html format, and charset encode utf-8 a answer correctly

Parse: Out.println ("*"); the output will not be wrapped in a page. If you want to change lines

Output <br> label required

Parsing: First of all, the session is really to solve the problem that HTTP cannot maintain customer status, so the A option is correct, the user information is also part of the customer status, so a can see that B is wrong; Then, whether the information in the session is safe does not depend on where it resides, It depends on the session implementation mechanism and the acquisition mechanism, and the session does not explicitly stipulate the size limit of its storage space, so C, D is not correct;

Parsing: First, the JSP is essentially a servlet, in the background after the dynamic compilation of the final output to the client normal HTML code, so need to run in the Servlet container, and Tomcat is the server-side servlet container, So you need to run under a server container such as Tomcat, and you can output dynamic pages, which results in the correct a option and the wrong B option. On the other hand, JSP is all called JavaServer pages, which literally means that a Java-language server-side page technology requires JDK support, so C and D are not.

parsing: This topic examines the cognitive level of the built-in object Config in JSP. the Config object is an object that is created automatically when the server starts, and when the servlet is created, it is usually the information required to get initialized.


Parsing: In the JSP page, you can use the output statement of the Java script to output the value of the string variable name to the page, or you can directly use the expression to output.


Parsing: Static contains the pages that are included in the page after they are executed together. At this time the variable i duplicate


Parse: Take out the attribute value in the Request object, the syntax format is: request.getattribute ("Myatr"); You can force type conversions


Parsing: This topic examines how to display a variable on a JSP page. Note the B option, and you cannot add a semicolon at the end.


Parse: Response.sendredirect ("index2.jsp"); redirect, cannot get value in Request object, so output is null


Parsing: This topic examines the understanding of the Response object set encoding, Response.setcontenttype ("Text/html;charset=utf-8"), which is set to encode and what encoding to use for the browser to open, and response.setcharacterencoding ("UTF-8"), refers to the setting of the code, so the browser may be garbled when opened the problem


Parsing: All JSPs are translated into the servlet's source code (Java) by the container after the client makes the request, and then the source (Java) is compiled into the servlet class, which is put into memory.  Among them, <%! int a=0;%> defines a member variable of a class, <% int b=0; %> is defined as a local variable in the service method. In addition to the first request, only the service method is called for the other two requests.




Parsing: by Session.setattribute ("login", "admin"), to the session in the form of Key-value key-value pairs of data, the syntax for the data is: (String) Session.getattribute ("Login"), the corresponding value is obtained by the key value.

JSP integration test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.