Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic concept interview questions of JSP

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you what are the contents of the interview questions about the basic concepts of JSP. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

JSP question 1. What are the built-in object functions of jsp?

A: there are 9 basic built-in components in JSP (which can correspond to 6 internal components of ASP):

Request client request, which contains parameters from the GET/POST request

The response web page sends back the response from the client

The properties of pageContext pages are managed here

Session session period related to the request

What application servlet is doing

The output that the out uses to send the response

Architectural components of config servlet

The page JSP page itself

Exception for error pages, uncaught exceptions

JSP question 2. What are the action functions of jsp?

A: there are six basic actions in JSP

Jsp:include: introduce a file when the page is requested.

Jsp:useBean: find or instantiate a JavaBean.

Jsp:setProperty: sets the properties of JavaBean.

Jsp:getProperty: outputs the properties of a JavaBean.

Jsp:forward: redirect the request to a new page.

Jsp:plugin: generate OBJECT or EMBED tags for Java plug-ins based on browser type

JSP question 3. What is the difference between dynamic INCLUDE and static INCLUDE in JSP?

A: dynamic INCLUDE is implemented with jsp:include action.

It always checks for changes in the files it contains, is suitable for including dynamic pages, and can take parameters

Static INCLUDE is implemented with include pseudo code, and will not check the changes of the files it contains. It is suitable for containing static pages.

Topic 4 of JSP. Common instructions of JSP

IsErrorPage (whether Exception objects can be used), isELIgnored (whether expressions are ignored)

JSP topic 5. What are the similarities and differences between JSP and Servlet, and what is the relationship between them?

A: JSP is an extension of Servlet technology, which is essentially a simple way of Servlet, with more emphasis on the appearance of the application. When JSP is compiled, it is "class servlet".

The main difference between Servlet and JSP is that the application logic of Servlet is in the Java file and is completely separated from the HTML in the presentation layer. In the case of JSP, Java and HTML can be combined into a file with a .jsp extension.

JSP focuses on views, while Servlet is mainly used to control logic.

How to implement request forwarding in JSP question 6, Jsp and Servlet, respectively?

The forwarding request of JSP can be accessed through

< jsp:forward>

The standard action is done; the Servlet forwards the request through the forward () method.

JSP question 7. What implicit objects does jsp have? What are the functions respectively?

Request request represents a HttpServletRequest object. It contains information about browser requests and provides several useful methods for getting cookie, header, and session data.

Response response represents a HttpServletResponse object and provides several methods for setting the response sent back to the browser (such as cookies, header information, etc.)

The out out object is an instance of javax.jsp.JspWriter and provides several methods that you can use to echo the output to the browser.

PageContext pageContext represents a javax.servlet.jsp.PageContext object. It is an API that facilitates access to a variety of namespaces and servlet-related objects, and wraps general servlet-related functions.

Session session represents a requested javax.servlet.http.HttpSession object. Session can store user's status information.

Application applicaton represents a javax.servle.ServletContext object. This helps to find information about the servlet engine and the servlet environment

Config config represents a javax.servlet.ServletConfig object. This object is used to access the initialization parameters of the servlet instance.

Page page represents an instance of servlet generated from this page

Exception represents the exception that occurs when the JSP page is running

JSP question 8. What are the two ways to jump? What's the difference?

A: there are two kinds, which are:

< jsp:include page="included.jsp" flush="true">

< jsp:forward page= "nextpage.jsp"/>

The former page does not go to the page referred to by include, but only displays the results of that page, and the main page is still the original page. It will come back after execution, which is equivalent to a function call. And can take parameters. The latter completely turns to the new page and will not come back. Is equivalent to a go to statement.

Thank you for reading! This is the end of this article on "what are the basic concept interview questions of JSP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report